FreeWiki:Citation templates and reference anchors

From FreeWiki
Jump to: navigation, search

Template:Hatnote

Citation templates are often used to format the citations that show in the reference list. Many of these templates can create anchors that allow links from reference templates that are placed in-text with the content to the full citation in the reference list. These links are a convenience and are not a requirement; the use of reference and citation templates is also not required.

The in-text links are formatted manually or automatically as #CITEREF normally followed by the author name(s) and the year of publication. The citation template then creates an anchor using an HTML id manually or automatically formatted as CITEREF followed by the author last name(s) and the year. For citations without an author, the anchor can be customized.

Anchor support across citation templates is not standardized, and not all templates support anchors.

This page discusses only general citation templates and does not include any of the hundreds of specific-source templates. See Category:Specific-source templates, although many of these may be in Category:Citation templates or not properly categorized. Many specific-source templates use a general citation template as a meta-template.

Types of anchors

  • Plain anchor— the anchor is the defined text
  • CITEREF anchor— the anchor consists of CITEREF plus the defined text
  • Auto anchor— the anchor is automatically built by concatenating (running together) template fields such as the author last names and the year (e.g. SmithJones1999)
  • Custom anchor— the anchor is created from text defined in a field
  • Reference- anchor— the anchor consists of Reference- plus the defined text

Anchor types can be combined. For example, a template could create a CITEREF auto anchor.

In-text reference templates that create links to anchors

These templates always create a link of the form #CITEREF plus the author last names (up to four) plus the year.

setting |Ref= will create a custom link.

Template:Col-begin Template:Col-break Templates

Template:Col-break Parameters used to build the anchor

last, surname, last1, surname1, author1, author, authors, author

Template:Col-end

When a custom link is needed, the first author field can be replaced by the desired text.

Citation templates that create anchors

These templates always create a CITEREF auto anchor; setting |ref= will create a custom plain anchor.

Template:Col-begin Template:Col-break Templates

Template:Col-break Parameters used to build the anchor

last, surname, last1, surname1, author1, author, authors, author
last2, surname2, author2
last3, surname3, author3
last4, surname4, author4
editor-last, editor-surname, editor1-last, editor1-surname, editor, editors
editor2-last, editor2-surname
editor3-last, editor3-surname
editor4-last, editor4-surname
date, year, publication-date

Template:Col-end

These citation templates create a plain custom anchor when |ref= is set or a CITEREF auto anchor when |ref=harv is set.

Template:Col-begin Template:Col-break Templates

Template:Col-break Parameters used to build the anchor

last, surname, last1, surname1, author1, author, authors, author
last2, surname2, author2
last3, surname3, author3
last4, surname4, author4
editor-last, editor-surname, editor1-last, editor1-surname, editor, editors
editor2-last, editor2-surname
editor3-last, editor3-surname
editor4-last, editor4-surname
date, year, publication-date

Template:Col-end

Template:Col-begin Template:Col-break Templates

Template:Col-break Parameters used to build the anchor

inventor-surname, inventor1-surname, inventor-last, inventor1-last, inventor, invent-1
inventor2-surname, inventor2-last, inventor2, invent2
inventor3-surname, inventor3-last, inventor3, invent3
inventor4-surname, inventor4-last, inventor4, invent4
year

Template:Col-end

Template:Col-begin Template:Col-break Templates

Template:Col-break Parameters used to build the anchor

people
date

Template:Col-end

Template:Col-begin Template:Col-break Templates

Template:Col-break Parameters used to build the anchor

last
year

Template:Col-end

Template:Col-begin Template:Col-break Templates

Template:Col-break Parameters used to build the anchor

publisher
year, date

Template:Col-end

These citation templates create a plain custom anchor when |ref= is set or a CITEREF custom anchor when |harvid= is set.
These citation templates create a plain custom anchor when |ref= is set or a Reference- custom anchor when |id= is set.
These citation templates create a plain custom anchor when |ref= is set.
These citation templates do not support anchors.

Date and year fields

Most of the templates will attempt to extract the year from the date field. If the date consists of anything other than a full date then the year extraction will fail. Most templates include a month field that can be used in conjunction with the year field.

Custom anchors

Custom anchors must be used when the template does not support auto anchors or when there is no author. The name of the website or organization can be used in place of the author name. Custom anchors can be crafted manually or with {{SfnRef}} / {{harvid}}.

Link and anchor names

Manually created names should start with CITEREF. If you choose to not do this, then the first character must begin with a letter A-Z or a-z. All names are case sensitive. HTML ids have other name rules, but the MediaWiki software automatically encodes spaces to underlines and Unicode characters to their equivalent hexadecimal characters.

Duplicate in-text links

Multiple instances of the same in-text link may be used to link to one citation in the reference list, and the in-text links can use the same name.

Duplicate anchors

The anchor name for each citation must be unique. Multiple instances of the same anchor will create ambiguous links and will cause invalid HTML output of the page. There is no automatic error checking. The W3C Validation Service can be used to check for duplicate HTML ids.

Where the same author has multiple publications within the same year, the citation template will create a duplicate anchor. The standard solution is to add a lower case alpha character to the year.

Templates without anchors

{{Wikicite}} can be used to add an anchor for any of the templates that do not support anchors. The |ref= field is used to create the anchor and the |reference= field is set to the citation template. The |ref= field should be enclosed in quotes and can be defined with {{SfnRef}}.