Template:SfnRef/doc

From SynCell
Jump to navigation Jump to search

{{#invoke:Message box|mbox}} {{#invoke:High-use|main|1=|2=|info=|demo=|form=|expiry=|system=}} {{#invoke:Shortcut|main|template=yes}} {{#invoke:Lua banner|main}}

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

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:

<templatestyles src="Block indent/styles.css"/>

{{Sfn|Rolling Stone|2004}}

You may code the value for the |ref= parameter manually, or you can use {{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}} and specify the same parameters as used with {{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}:

<templatestyles src="Block indent/styles.css"/>

{{SfnRef|Rolling Stone|2004}}

The full footnote:

<templatestyles src="Block indent/styles.css"/>

{{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 {{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}} template code and change the name of the template from "Sfn" to "SfnRef". If your short footnote includes page numbers such as {{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}, you can copy and paste it to create {{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}; the |p=48 parameter is not necessary but will do no harm.

Usage

<templatestyles src="Block indent/styles.css"/>

{{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] citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
Many authors and date are present {{SfnRef |Doe |Pérez |Kowalski |Al-Fulani |2024}}[4] citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
Author is publisher {{SfnRef|Museum of Modern Art|2024}} citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
{{SfnRef|MoMA|2024}} citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
Author is anonymous {{SfnRef|Anonymous|2024}}[5] citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
Author is missing {{SfnRef|''Title''|2024}} citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
{{SfnRef|"Title"|2024}} citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
Authors with the same name
  • {{SfnRef|F. Beauregard|2024}}
  • {{SfnRef|P. Beauregard |2024}}
  • {{#invoke:citation/CS1|citation
CitationClass=citation

}}

  • {{#invoke:citation/CS1|citation
CitationClass=citation

}}

  • {{#invoke:Footnotes|harvard_citation|template=harvnb}}
  • {{#invoke:Footnotes|harvard_citation|template=harvnb}}
Date is missing {{SfnRef|Smith|n.d.}}[6] citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
{{SfnRef|Smith}}[7] citation CitationClass=citation

}}

harvard_citation|template=harvnb}}
Date and author are missing {{SfnRef|[Description]|n.d.}}[8] citation CitationClass=citation

}}

harvard_citation|template=harvnb}}

Purpose

This template creates the proper value for the |ref= parameter of Citation Style 1 templates ({{#Invoke:Template link general|main|code=on}}, {{#Invoke:Template link general|main|code=on}}, {{#Invoke:Template link general|main|code=on}}, etc.) and the generic Citation Style 2 template {{#Invoke:Template link general|main|code=on}}.[9] It is intended to be paired with {{#Invoke:Template link general|main|code=on}}, {{#Invoke:Template link general|main|code=on}}, {{#Invoke:Template link general|main|code=on}}, {{#Invoke:Template link general|main|code=on}}, and related templates, and uses the same arguments. As explained above, {{#Invoke:Template link general|main|nolink=yes|code=yes}} is only necessary in a subset of the cases where those are used.

{{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}} 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 {{#Invoke:Template link general|main|nolink=yes|code=yes}} 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 {{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}} 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 {{#Invoke:Template link general|main|nolink=yes|code=yes|nowrap=yes}}, etc., interpret the anchor ID string which is normally auto-generated.

Consistent output: For use with CS1/CS2 templates, {{#Invoke:Template link general|main|code=on}} and its {{#Invoke:Template link general|main|code=on}} companion produce the most consistent citation formatting. For other citation styles that do not put dates in parentheses or brackets, matching short-footnote templates include {{#Invoke:Template link general|main|code=on}} and {{#Invoke:Template link general|main|code=on}}.

See also

  • {{#Invoke:Template link general|main|code=on}} – a <span>-based version for use with manually formatted, non-templated citations
  • {{#Invoke:Template link general|main|code=on}} – a wrapper for {{#Invoke:Template link general|main|nolink=yes|code=yes}} to create wikilinks with either superscript [n] or plain-text labels to other citations from inside a citation

{{#invoke:Navbox|navbox}}


Notes

<templatestyles src="Reflist/styles.css" />

  1. Such as {{#Invoke:Template link general|main|code=on}}, {{#Invoke:Template link general|main|code=on}}, {{#Invoke:Template link general|main|code=on}}, and {{#Invoke:Template link general|main|code=on}}.
  2. This is includes {{Cite patent}}, {{Cite comic}}, and {{Cite court}}. Hand-written citations can be assigned an anchor with the {{wikicite}} template.
  3. 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.
  4. 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.
  5. This anchor would be created automatically in CS1 citation templates using |Author=Anonymous.
  6. This anchor would be created automatically in CS1 citation templates using |date=n.d. in the full citation.
  7. This anchor would be created automatically in CS1 citation templates leaving |date= blank in the full citation.
  8. This anchor would be created automatically in CS1 citation templates using |date=n.d. and |title=[Description] in the full citation.
  9. As well as {{#Invoke:Template link general|main|code=on}} for comics; {{#Invoke:Template link general|main|code=on}} for U.S. court cases; and {{#Invoke:Template link general|main|code=on}} which wraps around handwritten citations.

{{#invoke:Check for unknown parameters|check|unknown=|preview=Page using Template:Reflist with unknown parameter "_VALUE_"|ignoreblank=y| 1 | colwidth | group | liststyle | refs }}