Template:SfnRef/sandbox
CITEREF
This is the template sandbox page for Template:SfnRef (diff). |
This template is used on approximately 144,000 pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
This template creates an identifier that is used as a link anchor for short citations. Many articles are cited with shortened footnotes, which usually link to full citations at the bottom of the page. {{SfnRef}} accepts the same parameters as most short citation templates[1] and create matching anchors when used in the |ref=
parameter of the full citation. Most {{cite xxx}} templates will automatically generate the anchor, or landing point, for links. The anchor can be created manually in situations where the automatic anchors would cause issues including:
- Multiple authors with the same last name
- No known last name for the author
- Unusual characters in the author field
- Multiple works in the same year by the same author
- Year of publication unknown
Additionally some less commonly used citation templates, and all full citations written by hand can only be linked to with a manually created anchor.[2]
Examples
[edit]When citing an article published in the December 2004 edition of Rolling Stone where the author is unknown, you might create a short footnote as follows:
{{Sfn|Rolling Stone|2004}}
You may code the value for the |ref=
parameter manually, or you can use {{SfnRef}}
and specify the same parameters as used with {{Sfn}}
:
{{SfnRef|Rolling Stone|2004}}
The full footnote:
{{Cite news |work=[[Rolling Stone]] |title=The RS 500 Greatest Songs of All Time |ref={{SfnRef|Rolling Stone|2004}} |date=December 2004}}
You can copy and paste the {{Sfn}}
template code and change the name of the template from "Sfn" to "SfnRef". If your short footnote includes page numbers such as {{Sfn|Rolling Stone|2004|p=48}}
, you can copy and paste it to create {{SfnRef|Rolling Stone|2004|p=48}}
; the |p=48
parameter is not necessary but will do no harm.
Usage
[edit]{{SfnRef|Name|Year}}
{{SfnRef|Name 1|Name 2|Name 3|Name 4|Year}}
The template accepts up to four names and a year of publication. If there are more than four authors, list only the first four. The last parameter is the year of publication, optionally with a letter suffixed if there are multiple citations by the same set of authors in the same year. All named parameters, such as |p=
are ignored.
Reference | Sfnref anchor markup | Full citation | Short citation |
---|---|---|---|
Author and date are present | {{SfnRef|Smith|2024}} [3]
|
Smith (2024). Title. Publisher. | Smith 2024 |
Many authors and date are present | {{SfnRef |Doe |Pérez |Kowalski |Al-Fulani |2024}} [4]
|
Doe, John; Pérez, Juan; Kowalski, Jan; Al-Fulani, Fulan; Horvat, Ivan; Hudjefa (2024). Title. Publisher. | Doe et al. 2024 |
Author is publisher | {{SfnRef|Museum of Modern Art|2024}}
|
Title. Museum of Modern Art. 2024. | Museum of Modern Art 2024 |
{{SfnRef|MoMA|2024}}
|
MoMA (2024). Title. Museum of Modern Art. 2024. | MoMA 2024 | |
Author is anonymous | {{SfnRef|Anonymous|2024}} [5]
|
Anonymous (2024). Title. Publisher. | Anonymous 2024 |
Author is missing | {{SfnRef|''Title''|2024}}
|
Title. Publisher. 2024. | Title 2024 |
{{SfnRef|"Title"|2024}}
|
"Title". Work. Publisher. 2024. | "Title" 2024 | |
Authors with the same name |
|
|
|
Date is missing | {{SfnRef|Smith|n.d.}} [6]
|
Smith (n.d.). Title. Publisher. | Smith n.d. |
{{SfnRef|Smith}} [7]
|
Smith. Title. Publisher. | Smith | |
Date and author are missing | {{SfnRef|[Description]|n.d.}} [8]
|
[Description]. Publisher. n.d. | [Description] n.d. |
Purpose
[edit]This template creates the proper value for the |ref=
parameter of Citation Style 1 templates ({{Cite journal}}
, {{Cite book}}
, {{Cite web}}
, etc.) and the generic Citation Style 2 template {{Citation}}
.[9] It is intended to be paired with {{Sfnp}}
, {{Sfn}}
, {{Harvp}}
, {{Harvnb}}
, and related templates, and uses the same arguments. As explained above, {{SfnRef}}
is only necessary in a subset of the cases where those are used.
{{Sfnp}}
and its variants create a short footnote that is linked to a full footnote. The templates create the link automatically, but the full footnote must be assigned the proper ID value to be a valid target for that link. This usually happens automatically using the full-citation template's author/editor and date/year parameters, but some cases need a custom anchor, and that is what {{SfnRef}}
is for.
When using the Citation Style 1 and 2 family of citation templates, a default ID is generated from the last names of the first four authors (or editors if there are no authors specified). However, if none of |last=
, |author=
, |editor-last=
, or their equivalents are present, use {{SfnRef}}
inside the CS1/CS2 template's |ref=
parameter to create a link anchor (perhaps using the publisher name or work title or an abbreviation thereof) without having to know the rules for how {{Sfnp}}
, etc., interpret the anchor ID string which is normally auto-generated.
The {{Vcite journal}} etc. templates (with Vcite
, not Cite
names) require the use of {{SfnRef}}
to work with {{Sfn}}
, {{Harvnb}}
, and related templates.
Consistent output: For use with CS1/CS2 templates, {{Sfnp}}
and its {{Harvp}}
companion produce the most consistent citation formatting. For use with Vancouver citation templates (and any other citation styles that do not put dates in parentheses/round-brackets), the matching short-footnote templates are {{Sfn}}
and {{Harvnb}}
.
See also
[edit]{{sfnref inline}}
– a<span>
-based version for use with manually formatted, non-templated citations{{citeref}}
– a wrapper for{{SfnRef}}
to create wikilinks with either superscript [n] or plain-text labels to other citations from inside a citation
Notes
[edit]- ^ Such as
{{Sfnp}}
,{{Sfn}}
,{{Harvp}}
, and{{Harvnb}}
. - ^ This is includes the Vancouver style templates, {{Cite comic}}, and {{Cite court}}. Hand-written citations can be assigned an anchor with the {{wikicite}} template.
- ^ This anchor would be created automatically in CS1 citation templates using
|last=Smith
and|date=2024
in the full citation.|author=
works the same as|last=
. If neither "last" nor "author" are used,|editor=
or|editor-last=
will be used to create the anchor. If none of these parameters are used, the anchor must be created manually. - ^ This anchor would be created automatically in CS1 citation templates using
|last1=Doe
,|last2=Pérez
, and so on, along with|Date=2024
in the full citation. - ^ This anchor would be created automatically in CS1 citation templates using
|Author=Anonymous
. - ^ This anchor would be created automatically in CS1 citation templates using
|date=n.d.
in the full citation. - ^ This anchor would be created automatically in CS1 citation templates leaving
|date=
blank in the full citation. - ^ This anchor would be created automatically in CS1 citation templates using
|date=n.d.
and|title=[Description]
in the full citation. - ^ As well as
{{Vcite journal}}
,{{Vcite journal}}
,{{Vcite book}}
and other templates that generate Vancouver system references;{{cite comic}}
for comics;{{cite court}}
for U.S. court cases; and{{wikicite}}
which wraps around handwritten citations.