Template:SfnRef
CITEREF
This template is used on many pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them. |
This template uses Lua: |
Generate an identifier suitable as an anchor for a Harvard citation. This template, which can be used with either the name {{SfnRef}}
or the alias {{harvid}}
, is intended to be paired with Harvard citation templates such as {{Sfnp}}
, {{Sfn}}
, {{Harvp}}
, and {{Harvnb}}
. This template uses the same arguments as the other citation templates. As explained below, this template is needed only in some cases when the Harvard citation templates are used.
Usage
{{SfnRef|Surname of author|Year}}
{{SfnRef|Surname of author 1|Surname of author 2|Surname of author 3|Surname of author 4|Year}}
The first parameter is the first author's last name. Up to four authors can be given as parameters; if there are more than four authors, list only the first four. The last parameter is the year of publication, possibly with a letter suffixed to avoid ambiguity if there are multiple citations by the same set of authors in the same year.
All named parameters such as |p=
are ignored.
Purpose
This template creates the proper value for the |ref=
parameter of Citation Style 1 templates ({{Cite journal}}
, and {{Cite book}}
. It is intended to be paired with {{Sfnp}}
, {{Sfn}}
, {{Harvp}}
, {{Harvnb}}
, and related templates, and uses the same arguments. As explained below, {{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=
, |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.
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}}
.
Examples
With the shortened footnote template
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}}
|ref=harv
will not work in this case because "Rolling Stone" is not the name of the author. 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.
Deprecated inline use
Running text can link to this citation with markup like the following:
{{harv|Peh|Ng|2009}}
which generates the following:
To see how it works, click on the "(Peh & Ng 2009)".
Note: Use of inline parenthetical referencing of that sort within articles has been deprecated by the Wikipedia community since 2022. This usage has not been deprecated within internal pages such as Wikipedia documentation, user pages, or wikiprojects, though there is rarely a practical use for it instead of just using normal citation footnotes.
See also
{{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