Template:Sfnlink/doc

From the AARoads Wiki: Read about the road before you go
Jump to navigation Jump to search

Creates a one-directional wikilink to the first matching citation template of the article. Unlike {{sfn}}, it does not create a short citation; it creates only the outgoing link. This could be used to link two references; for example, to link a translated work to the original work in a list of references that contains both of them. It may also be used as a workaround for certain false positive errors such as "missing key" errors when short citations are embedded within list-defined references, or as linkage from a Talk page discussion to a citation in an article.

Usage

{{sfnlink|lastname|year|pp=12–15}} – typical usage.

{{sfnlink|last1|last2|...|year|p=91|loc=...|text=Link text|article=Article name|rev=oldid|lang=xx|nb=yes}}

Quick start

If you want to create a one-way link to a full citation in the Bibliography section of your article which already has a working {{sfn}} that links to it, just copy the sfn invocation out of the wikicode, change 'sfn' to 'sfnlink', and it should just work. You can add param |text= if you want to change the display text underlying the link, and if you are linking from the Talk page, add |article = * to the invocation to link to the article (mainspace) citation.

Parameters

Positional parameters 1–5 are the same as in template {{sfn}}: typically, one to four author surnames, and a YYYY year. The first author surname (positional param |1=) is required; other authors and the year are required if available in the full citation. If present, year must be the last positional parameter. All parameters except the first are optional.

Basic – these are the same as the parameters of sfn:

  • <last1> – surname of first author or corporate author (required)
  • <last2> – <last4> – positional parameters; surnames of next three authors
  • <year> – four-digit year; may have a lowercase disambiguation letter like 2012a
  • |p= – specific page referenced in the source (alias: |page=)
  • |pp= – comma-separated list of individual pages and / or range(s) of pages referenced in the source (alias: |pages=)
  • |loc= – in-source location: information such as a section or figure number; usually used when |p= and |pp= are inappropriate, but may be used to supplement them.

Supplementary – parameters for configuring the link, how it's displayed, and extending its range:

  • |nb=yes – removes parentheses ('nb' = 'no brackets') from around the year. Default: year is displayed in parens.
  • |text= – display text for the link. (default: <last1> – <last4> in comma series, plus the parenthesized year)(interacts with 'nb'; see param notes)
  • |article= – article or page title; may be used to link to a short footnote's full citation destination on another article or page. Use an asterisk (i.e., |article=*) to target the article or subjectpage with which the Talk page is associated. (restricted; see param notes)
  • |rev=revision id ("oldid"); may be used to link to a full citation in an old revision of an article (restricted; overrides 'article'; see param notes)
  • |lang= – the language code of the foreign language Wikipedia where the citation is located; requires 'rev' or 'article'; (restricted; see param notes)

Parameter notes

By design, positional parameters 1 – 5, the page params, and param 'loc' are the same as parameters in template Sfn. In most cases where {{sfn}} generates a false missing key error, it can be resolved simply by changing sfn to sfnlink and leaving everything else alone.

You can specify any value for |nb= to remove parentheses from around the year, such as |nb=yes, |nb=1 etc. (Even |nb=no does it.) Param |text= overrides any value for |nb=; if you want parens while using 'text', just supply them in the param value. For an alternative way to accomplish this, see template {{Sfnlinknb}}.

Optional parameter |article= is not recommended for mainspace, but it may be useful in Talk page discussions to link to citations in related discussions on other pages, or to link directly to a mainspace article citation without having to resolve it with a local references section on a Talk page. Use |article=* as a shortcut to indicate that your target citation is on the page associated with the Talk page you are on (i.e., at {{ARTICLEPAGENAME}} ).

Optional parameter |rev= is not recommended for use in mainspace. If present, the revision id is sufficient to uniquely identify a particular revision of an article, so param |article= is superfluous in that case. You may, if you wish, use |rev= and |article= together just for the documentary value of having the article named in the wikicode for the benefit of other editors, however when both are present, the value of |article= is ignored and only the |rev= is used.

Param |lang= should not be used in mainspace. In tandem with param |article= or |rev=, it provides linkage to citations on foreign Wikipedias, and is designed primarily for use on Talk pages where another Wikipedia has a citation of interest to discuss here. Almost all foreign Wikipedias support the use of short citations with linkage to full citations, however, German and Finnish Wikipedias do not, so codes de fi may not be used as a value for |lang= and will generate an error. You can use |lang= and |rev= together to link to a citation in an old version of a foreign Wikipedia article (use of |article= is optional in this case; if used, it is of documentary value only and does not affect the result).

Examples

Example 1: Connect the citation of a translated work to the citation of the original
Markup Renders as
The sun is a star.{{sfn|Smith|2015|pp=251–254}} It is hot.{{sfn|Dupont|2012|p=19}}

=== Citations ===
{{reflist}}

=== Works cited ===
* {{cite book |last=Dupont |first=Yves |date=2012 |title=Les étoiles |publisher=Gallimard |location=Paris |lang=fr}}
*: ''other citations here...''
* {{cite book |last=Smith |first=Stan |date=2015 |title=Stars |translator=G. Forest |orig-date=1st pub. {{citelink|Dupont|2012|text=Gallimard:2012}} |publisher=MacMillan |location=New York}}

The sun is a star.[1] It is hot.[2]

Citations
  1. ^ Smith 2015, pp. 251–254.
  2. ^ Dupont 2012, p. 19.
Works cited
  • Dupont, Yves (2012). Les étoiles (in French). Paris: Gallimard.
    other citations here...
  • Smith, Stan (2015) [1st pub. Gallimard:2012]. Stars. Translated by G. Forest. New York: MacMillan.
Example 2: Add a link in a Talk page discussion targeting a particular citation in the article
Markup Renders as
=== Some discussion ===

The reference that is now listed there ({{sfnlink|Campbell|2004|article=Bede}}) is only accessible with a subscription... [[w:User:Example1|User:Example1]]
Some discussion

The reference that is now listed there (Campbell (2004)) is only accessible with a subscription... User:Example1

Note: if discussion "Some discussion" is taking place at the associated Talk page (i.e., 'Talk:Bede' in this case), then the following code using the asterisk shortcut is equivalent to the above: {{sfnlink|Campbell|2004|article=*}}.

Example 3: Use list-defined references with nested sfnlinks (workaround for sfn missing-key error bug)
Markup Renders as
The sun is a star.{{sfn|Smith|1993|p=25}}{{efn|name="disc"}} It is hot.{{efn|name="how-hot"}}

=== Notes ===
{{notelist |refs=
{{efn|name="disc"|The only star close enough to appear larger than a point of light. {{sfnlink|Jones|2008|p=4}}}}
{{efn|name="how-hot"|About 5,500° Kelvin at the surface. {{sfnlink|Smith|1993|p=32}}}}
}}
=== Citations ===
{{reflist}}

=== Works cited ===
* {{cite book |last=Smith |first=Karen |date=1993 |title=The Sun |publisher=Dunlap}}
* {{cite book |last=Jones |first=Allen |date=2008 |title=Astronomy |publisher=Scribners}}

The sun is a star.[1][a] It is hot.[b]

Notes
  1. ^ The only star close enough to appear larger than a point of light. Jones (2008) p. 4
  2. ^ About 5,500° Kelvin at the surface. Smith (1993) p. 32
Citations
  1. ^ Smith 1993, p. 25.
Works cited
  • Smith, Karen (1993). The Sun. Dunlap.
  • Jones, Allen (2008). Astronomy. Scribners.

Example 4: Link a citation in an old, 2016 rev of Darshan (Indian religions):

  • {{sfnlink|Flood|2011|p=194|nb=yes|rev=701715751}}Flood 2011 p. 194 — Note: no parens around the year, per param 'nb'

Example 5: Link to a citation in the French Wikipedia article Cinéma:

Notes

Sfnlink creates only a wikilink, namely, the same link as the Harvard citation templates; compare {{harvnb}} and {{harvid}}. In contradistinction to template sfn, sfnlink does not create a named footnote, and two identical sfnlinks are not combined, they are like two on-page wikilinks that happen to point to the same destination. Using CITEREF directly is equivalent to the wikilink portion of sfnlink.

Sfnlink may be helpful for avoiding false-positive "missing key" citation errors when using list-defined references which contain embedded citations. For example, if you have list-defined refs or {{efn}}s that contain short footnotes ({{Sfn}}, {{harv}}, etc.) in them, you will get a false-positive H:CERMK error due to known bug . Replacing the embedded short footnotes with Sfnlink is a workaround that will avoid the error.

When to use

This template may be useful for various situations in which you need a unidirectional link to an existing citation. Here are some possible use cases:

  • to discuss an existing article citation from the Talk page of the article, and link to it;
  • to add a unidirectional link to a citation within the article itself, where {{harvnb}} isn't apt, such as when you need to change the link text; for example:
    • to link a citation of a translated work, to an another citation representing the original language work'
    • to link one author crediting another: when the author of source A refers to source B in their work, and you have citations to both A and B in your article, you can link words in the |quote= param of A directly to your B citation.
  • to avoid certain bugs, such as false positive errors when an sfn template is embedded in a list-defined reference.
  • to discuss an existing article citation located in a different article, or in a page on another Wikipedia.

An alternative to this template is {{citeref}}; when used from mainspace, they are functionally equivalent. From talk space, an alternative is {{sfnt}}.

When not to use

Don't use this template:

  • to create a short citation; use {{sfn}} instead;
  • to create a link from a chapter of a book to the full {{cite book}} citation; use {{citec}} / {{harvc}} instead;
  • to create a unidirectional link from an article to a citation within the article, if one of the templates implemented by Module:Footnotes will do what you need, such as {{harvnb}}.

See also