Jump to content

විකිපීඩියා:Citation templates and reference anchors

විකිපීඩියා වෙතින්

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.

[සංස්කරණය]

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.

Templates

Parameters used to build the anchor

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

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.

Templates

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

Templates

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

Templates

Parameters used to build the anchor

people
date

Templates

Parameters used to build the anchor

last
year

Templates

Parameters used to build the anchor

publisher
year, date

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}}.

[සංස්කරණය]

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.

[සංස්කරණය]

To avoid the sometimes difficult-to-remember syntax for manual links to CITEREF anchors, {{citeref}} can be used to create internal wikilinks with either small superscript-style labels (like this[n]) or plain free-text labels to such anchors. It can be used inside of other citations. In addition, {{citelink}} and {{remoteref}} can also create internal wikilinks, and may also be used to create wikilinks to other pages, such as linking to a CITEREF anchor from the article Talk page (or from any page, like thisසැකිල්ල:Remoteref), or to an anchor in a foreign Wikipedia article (like thisසැකිල්ල:Remoteref) and may also be used සැකිල්ල:Sfnlink another citation.

[සංස්කරණය]

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}}.