Wiktenauer logo.png

Template:Sfn/doc

From Wiktenauer
Jump to navigation Jump to search

Shortened footnote template

Purpose

Creates a short author-date citation in a footnote. To read a full description of how these shortened footnotes are used in Wikipedia, see "Shortened footnotes" in Wikipedia:Citing sources. Features:

  • Automatically combines identical footnotes.
  • Automatically creates a one-way link to a citation template at the bottom of the page. The anchor is created only if you add the parameter |ref=harv to the citation template. The link only operates if the parameters |last=, |last2=... and |year= of that citation template match the first arguments to {{sfn}}. (It is also possible to use the citation template's |ref= parameter to create an anchor that this template will link to. See {{sfnRef}})

Usage

{{Sfn |Last name of author(s)|Year| loc = Location in the text}}

Instead of using the optional loc parameter, you may also use one of the following parameters:

  • |p=page
  • |pp=pages
Notes
  • The first parameter is the author's last name.
  • Up to four authors can be given as parameters (see the examples). If there are more than 4 authors only the first 4 should be listed; listing more will cause odd things to happen.
  • The next parameter is the year of publication.
  • The "loc = " parameter is the location of the cited material within the reference. This parameter is optional.
  • The parameter p is an optional page parameter; thus "{{sfn|Smith|2006| p=25}}" yields "Smith 2006, p. 25".
  • The parameter pp is an optional page range parameter; thus "{{sfn|Smith|2006| pp=25–26}}" yields "Smith 2006, pp. 25–26".
  • For authors who have published more than one work in the same year, the standard way to differentiate such works is to put a lowercase letter after the year (e.g. year=2006a and year=2006b).
  • If multiple references are made to the same location of the same work, only one footnote is generated.
  • If additional comments are needed, use {{Harvnb}} or {{Harvtxt}} in <ref> tags to achieve a similar effect. E.g.
    Jones writes "blah blah".<ref>Quoted in {{Harvnb|Smith|2006|p=25}}.</ref>


Editors editing this template are requested to consider making parallel changes to {{Harv}}, {{Harvnb}} and {{Harvs}}.

Examples

Markup Result
Article text.{{sfn |Smith|2006| p=25}} Article text.[1]
Article text.{{sfn |Smith|2006| pp=25&ndash;26}} Article text.[2] Citing multiple pages.
Article text.{{sfn |Smith|2006| loc=&sect;8.5}} Article text.[3] A location, rather than a page number.
Article text.{{sfn |Smith|2006| p=25}} Article text.[1] A second citation of the same page.
Article text.{{sfn |Smith|Jones|2006| p=25}} Article text.[4] Two authors.
Article text.{{sfn |Smith|Jones|Brown|2009| p=25}} Article text.[5] Three authors.
Article text.{{sfn |Smith|Jones|Brown|Black|2006| p=25}} Article text.[6] Large numbers of authors.
Article text.{{sfn |Smith|1993a| p=25}} More text.{{sfn |Smith|1993b| p=32}} Article text.[7] More text.[8] Two papers in the same year.
Article text.{{sfn |Solo}} Article text.[9] One author, no year, no page.
Article text.{{sfn |Popular Magazine|1973}} Article text.[10] Corporate author (no author in citation template).
Article text.{{sfn |A particularly unusual citation}} Article text.[11] A particularly unusual citation
Article text.<ref>{{harvnb|Smith|2006|p=25}}, {{harvnb|Smith|Brown|2006}}.</ref> More article text.<ref>Quoted in {{harvnb|Smith|2006|p=25}}.</ref> Article text.[12] More article text.[13]

Combined footnotes and other situations where this template is inappropriate.

==Notes==
{{reflist}}

==References==
* {{cite book
| last = Smith | first = John
| year = 2006
| title = Smith's Book
| ref = harv
}}
* {{cite web
| last = Smith | first = John
| last2 = Jones | first2 = Sam
| title = Smith & Jones website
| url = http://en.wikipedia.org
| year = 2006
| ref = harv
}}
* {{cite news
| last = Smith | first = John
| last2 = Jones | first2 = Sam
| last3 = Brown | first3 = Tom
| title = Article by Smith, Jones and Brown
| year = 2009
| newspaper = Big Urban Newspaper
| ref = harv
}}
* {{cite journal
| last = Smith
| last2 = Jones
| last3 = Brown
| last4 = Black
| year= 2006
| title= Smith, Jones, Brown and Black's Paper
| journal = Important Journal
| ref = harv
}}
* {{cite journal
| last = Smith | first = Karen
| year = 1993a
| title = Smythe's first paper
| journal= Important Journal
| ref = harv
}}
* {{cite journal
| last = Smith | first = Karen
| year = 1993b
| title = Smythe's second paper
| journal= Another Important Journal
| ref = harv
}}
* {{cite web
| last = Solo
| first = Han
| title = Freeze-Dried: My Story
| url = http://en.wikipedia.org/
| ref = harv
}}
* {{cite magazine
| magazine = Popular Magazine
| title = An Article by an Anonymous Author
| year = 1970
| ref = {{sfnRef|Popular Magazine|1970}}
}}
* {{wikicite 
| reference = A source that can't be described 
using our citation templates at all.
| ref = {{sfnRef|A particularly unusual citation}} 
}}

Notes
References
  • Smith, John (2006). Smith's Book. 
  • Smith, John; Jones, Sam (2006). "Smith & Jones website". http://en.wikipedia.org. 
  • Smith, John; Jones, Sam; Brown, Tom (2009). "Article by Smith, Jones and Brown". Big Urban Newspaper. 
  • Smith; Jones; Brown; Black (2006). "Smith, Jones, Brown and Black's Paper". Important Journal. 
  • Smith, Karen (1993a). "Smythe's first paper". Important Journal. 
  • Smith, Karen (1993b). "Smythe's second paper". Another Important Journal. 
  • Solo, Han. "Freeze-Dried: My Story". http://en.wikipedia.org/. 
  • "An Article by an Anonymous Author". Popular Magazine. 1970. 
  • A source that can't be described using our citation templates at all.

Anchor IDs

This template generates an HTML IDd as an anchor to link the short citation to the full citation.. The |ref=harv field is necessary in each of the {{cite ...}} templates to enable the id. The {{citation}} template always generates an id.

If the article cites multiple works by the same author in the same year, then duplicate IDs will be generated. One method to resolve this is to add an alpha suffix to the year. Example: 2009a, 2009b, 2009c.

If works are cited where the author or year is unknown— such as for a web page —then an invalid ID will be generated. To resolve this, create a custom ID:

{{sfn|cite name|year}}
{{cite ... |ref=CITEREFcite_nameyear }}

Where cite_name is a name such as the publisher, and must follow these rules:

  • Must begin with a letter A-Z or a-z
  • Can be followed by: letters (A-Za-z), digits (0-9), hyphens ("-"), underscores ("_"), colons (":"), and periods (".")
  • Spaces in the |ref= field must be replaced with underscores
  • Case-sensitive

SfnRef

You may use the {{SfnRef}} template to generate the proper value for the |ref= parameter. Pass the same parameters used with {{sfn}} to {{SfnRef}}:

{{sfn|cite name|year}}
{{cite ... |ref={{SfnRef|cite name|year}} }}

Articles using {{sfn}} should be checked for duplicate IDs with the W3C Markup Validation Service.

Implementation notes

This template call

{{sfn|Smith|2006|p=26}}

should have exactly the same functionality as

<ref name=Smith200626>{{Harvnb|Smith|2006|p=26}}</ref>