Template:Citation/doc

The Citation template generates a citation for a book, periodical, contribution in a collective work, patent, or a web page. It determines the citation type by examining which parameters are used.

If invoked with the right parameters, this template produces output identical to that of the Cite templates, such as Cite book and Cite web. The default behavior sometimes differs from that of the Cite templates; for example, this template by default generates anchors for Harvard references whereas the Cite templates do not (although they can be made to do so), and this template by default uses commas to separate some fields that the Cite templates separate with periods (full stops).

The template should be inserted after punctuation, such as a period or comma.

All parameter names are lowercase.

Simple citation
This template gives the most commonly used attributes. You can copy the horizontal form or vertical form below and then add in extra attributes from the full list. Spacing and ordering is irrelevant.


 * last: The author's surname or last name. Don't use with author.
 * first: The author's first or given name(s).
 * year: Year of authorship or publication. Mandatory for use with links from Template:Harvard citation, unless date specifies both month and year.
 * title: Title of the work. Mandatory for web references.
 * publisher: The name of the publisher. Omit terms such as Publishers, Co., Inc., Ltd., etc., but retain the words Books or Press. Not normally included where the publication is a periodical which has its own WikiDevi article (e.g. Newsweek, Billboard).
 * publication-place (or place or location): The city of publication. If more than one town/city is listed on the title page, give the first one or the location of the publisher's head office. Omit when the publication is a periodical whose name specifies the location (e.g. The New York Times, The Times of India)
 * page: For use when one page is cited. Adds "p." before the page number. Do not use with pages.
 * url: A url of an online location where the item can be found. If the url includes double quotes, these must be encoded as "%22".
 * accessdate: Date when the url was accessed.

Full citation parameters
These can be used for all types of publication except patents. All are optional and indentation is used simply to group related items — these may be mutually exclusive where indicated. Some hyphenated names can also be placed without hyphens.

Anchored citations
This template can generate a citation that can be combined with shortened footnotes or parenthetical referencing. It does this by creating an HTML anchor containing an ID. The special parameter harv generates an ID suitable for Harvard referencing templates such as harv as specified in the next section; this is the default for the citation template. To disable anchor generation, specify none (in contrast, other Cite templates such as cite book and cite news do not create an anchor by default). You can also specify the ID directly, using the ID parameter. For example, suppose an article's References section contains the markup: which generates the citation: Then, the markup " " generates a parenthetical reference "(Freud 1930)" containing a wikilink to the citation (try clicking on the wikilink).

Anchors for Harvard referencing templates
IDs compatible with Harvard referencing templates such as harv are computed from the last names of the authors and the year of the cited source. For example, the markup " " generates the Harvard reference "", which wikilinks to the citation whose markup and appearance are shown below: In this example the citation template defines, and the harv template uses, the HTML ID " ", composed by concatenating the string " " with the last names of the authors and the year. The harvid template can be used to generate such IDs, for example,  generates " ".

Related methods which leave only a number in the text are to use the harvnb template enclosed in the html code, or to use the sfn template alone. The example above would be  or   both of which generate a footnote, such as
 * 17.

The names of only the first four authors are used; other author names are not concatenated to the ID. If no author names are given, editor names are used instead. For patents, inventor names are used instead of authors or editors. If these names are not given, this template does not generate an anchor.

Last names are used, as specified by the parameters last1 (or last), last2, last3, and last4, and similarly for editor1-last etc. and for inventor1-last etc. If a full name is given but no last name is specified, this template falls back on the full name, but this usage is not recommended. For example, in " " no last name is given, so this citation cannot be combined with the Harvard reference " ". To make these citation and harv invocations compatible, either replace "Sigmund Freud" with "Sigmund Freud", or add "ref" to the citation invocation, or add the same ref parameter (say, "EgoId") to both the citation and the harv invocations.

Similarly, the year is used, as specified by year. If no year is given, this template attempts to derive the year from date (or, if no date is given, from publication-date) by applying the MediaWiki#time function. This heuristic works with many common date formats (American, International and ISO 8601 standard format YYYY-MM-DD as listed in WP:MOS), but may not work as expected with other formats, so when in doubt it may be safer to use year. Note that if only a year, say 2005, is known you must use 2005 rather than 2005.

IDs must be unique
Names, years, and hand-specified IDs must be chosen so that the IDs are unique within a page; otherwise the HTML will not conform to the W3C standards, and any references to the citations will not work reliably. For example, suppose a page contains the following two citations with harv-compatible IDs:

If these citations were altered to say "2008" rather than "2008a" and "2008b", the resulting page would not work, because the two different citations would both attempt to use the ID " ". To avoid this problem, distinguish the citations by appending suffixes to the years, e.g., "2008a" and "2008b", as was done above. Any Harvard references to these citations should use years with the same suffixes.

It is good practice to verify that a page does not contain duplicate IDs by using the W3C Markup Validation Service; see External links.

Tools
See WikiDevi:Citing sources for a list of tools that can help create a reference in the "citation" format.

Template Data
<!-- {	"description": "The Citation template generates a citation for a book, periodical, contribution in a collective work, patent, or a web page. It determines the citation type by examining which parameters are used.", "params": { "last": { "label": "author surname", "type": "string", "description": "surname of the author of the cited material" },		"first": { "label": "author given name", "type": "string", "description": "given name (first name) of the author of the cited material" },		"title": { "label": "title of source", "type": "string", "description": "Title of source; displays in italics." },		"date": { "label": "date of source", "type": "string", "description": "Full date of source being referenced in the same format as other publication dates in the citations.[1] Do not wikilink. Displays after the authors and enclosed in parentheses. If there is no author, then displays after publisher." },		"url": { "label": "url of source", "type": "string", "description": "URL of an online location where the text of the publication can be found." },       "1": {            "label": "1", "description": "", "type": "string", "required": false },       "2": {            "label": "2", "description": "", "type": "string", "required": false },       "3": {            "label": "3", "description": "", "type": "string", "required": false },       "inventor-surname": { "label": "inventor-surname", "description": "", "type": "string", "required": false },       "inventor1-surname": { "label": "inventor1-surname", "description": "", "type": "string", "required": false },       "inventor-last": { "label": "inventor-last", "description": "", "type": "string", "required": false },       "inventor1-last": { "label": "inventor1-last", "description": "", "type": "string", "required": false },       "inventor": { "label": "inventor", "description": "", "type": "string", "required": false },       "invent1": { "label": "invent1", "description": "", "type": "string", "required": false },       "invent-1": { "label": "invent-1", "description": "", "type": "string", "required": false },       "country-code": { "label": "country-code", "description": "", "type": "string", "required": false },       "inventor2-surname": { "label": "inventor2-surname", "description": "", "type": "string", "required": false },       "inventor2-last": { "label": "inventor2-last", "description": "", "type": "string", "required": false },       "inventor2": { "label": "inventor2", "description": "", "type": "string", "required": false },       "invent2": { "label": "invent2", "description": "", "type": "string", "required": false },       "inventor3-surname": { "label": "inventor3-surname", "description": "", "type": "string", "required": false },       "inventor3-last": { "label": "inventor3-last", "description": "", "type": "string", "required": false },       "inventor3": { "label": "inventor3", "description": "", "type": "string", "required": false },       "invent3": { "label": "invent3", "description": "", "type": "string", "required": false },       "inventor4-surname": { "label": "inventor4-surname", "description": "", "type": "string", "required": false },       "inventor4-last": { "label": "inventor4-last", "description": "", "type": "string", "required": false },       "inventor4": { "label": "inventor4", "description": "", "type": "string", "required": false },       "invent4": { "label": "invent4", "description": "", "type": "string", "required": false },       "inventor-given": { "label": "inventor-given", "description": "", "type": "string", "required": false },       "inventor1-given": { "label": "inventor1-given", "description": "", "type": "string", "required": false },       "inventor-first": { "label": "inventor-first", "description": "", "type": "string", "required": false },       "inventor1-first": { "label": "inventor1-first", "description": "", "type": "string", "required": false },       "inventor2-given": { "label": "inventor2-given", "description": "", "type": "string", "required": false },       "inventor2-first": { "label": "inventor2-first", "description": "", "type": "string", "required": false },       "inventor3-given": { "label": "inventor3-given", "description": "", "type": "string", "required": false },       "inventor3-first": { "label": "inventor3-first", "description": "", "type": "string", "required": false },       "inventor4-given": { "label": "inventor4-given", "description": "", "type": "string", "required": false },       "inventor4-first": { "label": "inventor4-first", "description": "", "type": "string", "required": false },       "inventorlink1": { "label": "inventorlink1", "description": "", "type": "string", "required": false },       "inventorlink": { "label": "inventorlink", "description": "", "type": "string", "required": false },       "inventorlink2": { "label": "inventorlink2", "description": "", "type": "string", "required": false },       "inventorlink3": { "label": "inventorlink3", "description": "", "type": "string", "required": false },       "inventorlink4": { "label": "inventorlink4", "description": "", "type": "string", "required": false },       "country": { "label": "country", "description": "", "type": "string", "required": false },       "publication-number": { "label": "publication-number", "description": "", "type": "string", "required": false },       "patent-number": { "label": "patent-number", "description": "", "type": "string", "required": false },       "number": { "label": "number", "description": "", "type": "string", "required": false },       "description": { "label": "description", "description": "", "type": "string", "required": false },       "status": { "label": "status", "description": "", "type": "string", "required": false },       "publication-date": { "label": "publication-date", "description": "", "type": "string", "required": false },       "pubdate": { "label": "pubdate", "description": "", "type": "string", "required": false },       "issue-date": { "label": "issue-date", "description": "", "type": "string", "required": false },       "gdate": { "label": "gdate", "description": "", "type": "string", "required": false },       "year": { "label": "year", "description": "", "type": "string", "required": false },       "fdate": { "label": "fdate", "description": "", "type": "string", "required": false },       "pridate": { "label": "pridate", "description": "", "type": "string", "required": false },       "assign1": { "label": "assign1", "description": "", "type": "string", "required": false },       "assign2": { "label": "assign2", "description": "", "type": "string", "required": false },       "ref": { "label": "ref", "description": "", "type": "string", "required": false },       "separator": { "label": "separator", "description": "", "type": "string", "required": false },       "separator": { "label": "separator", "description": "", "type": "string", "required": false },       "quote": { "label": "quote", "description": "", "type": "string", "required": false },       "postscript": { "label": "postscript", "description": "", "type": "string", "required": false },       "author-separator": { "label": "author-separator", "description": "", "type": "string", "required": false },       "author-mask": { "label": "author-mask", "description": "", "type": "string", "required": false },       "authormask": { "label": "authormask", "description": "", "type": "string", "required": false },       "surname": { "label": "surname", "description": "", "type": "string", "required": false },       "last1": { "label": "last1", "description": "", "type": "string", "required": false },       "surname1": { "label": "surname1", "description": "", "type": "string", "required": false },       "author1": { "label": "author1", "description": "", "type": "string", "required": false },       "author": { "label": "author", "description": "", "type": "string", "required": false },       "authors": { "label": "authors", "description": "", "type": "string", "required": false },       "last2": { "label": "last2", "description": "", "type": "string", "required": false },       "surname2": { "label": "surname2", "description": "", "type": "string", "required": false },       "author2": { "label": "author2", "description": "", "type": "string", "required": false },       "last3": { "label": "last3", "description": "", "type": "string", "required": false },       "surname3": { "label": "surname3", "description": "", "type": "string", "required": false },       "author3": { "label": "author3", "description": "", "type": "string", "required": false },       "last4": { "label": "last4", "description": "", "type": "string", "required": false },       "surname4": { "label": "surname4", "description": "", "type": "string", "required": false },       "author4": { "label": "author4", "description": "", "type": "string", "required": false },       "last5": { "label": "last5", "description": "", "type": "string", "required": false },       "surname5": { "label": "surname5", "description": "", "type": "string", "required": false },       "author5": { "label": "author5", "description": "", "type": "string", "required": false },       "last6": { "label": "last6", "description": "", "type": "string", "required": false },       "surname6": { "label": "surname6", "description": "", "type": "string", "required": false },       "author6": { "label": "author6", "description": "", "type": "string", "required": false },       "last7": { "label": "last7", "description": "", "type": "string", "required": false },       "surname7": { "label": "surname7", "description": "", "type": "string", "required": false },       "author7": { "label": "author7", "description": "", "type": "string", "required": false },       "last8": { "label": "last8", "description": "", "type": "string", "required": false },       "surname8": { "label": "surname8", "description": "", "type": "string", "required": false },       "author8": { "label": "author8", "description": "", "type": "string", "required": false },       "last9": { "label": "last9", "description": "", "type": "string", "required": false },       "surname9": { "label": "surname9", "description": "", "type": "string", "required": false },       "author9": { "label": "author9", "description": "", "type": "string", "required": false },       "first1": { "label": "first1", "description": "", "type": "string", "required": false },       "given1": { "label": "given1", "description": "", "type": "string", "required": false },       "given": { "label": "given", "description": "", "type": "string", "required": false },       "first2": { "label": "first2", "description": "", "type": "string", "required": false },       "given2": { "label": "given2", "description": "", "type": "string", "required": false },       "first3": { "label": "first3", "description": "", "type": "string", "required": false },       "given3": { "label": "given3", "description": "", "type": "string", "required": false },       "first4": { "label": "first4", "description": "", "type": "string", "required": false },       "given4": { "label": "given4", "description": "", "type": "string", "required": false },       "first5": { "label": "first5", "description": "", "type": "string", "required": false },       "given5": { "label": "given5", "description": "", "type": "string", "required": false },       "first6": { "label": "first6", "description": "", "type": "string", "required": false },       "given6": { "label": "given6", "description": "", "type": "string", "required": false },       "first7": { "label": "first7", "description": "", "type": "string", "required": false },       "given7": { "label": "given7", "description": "", "type": "string", "required": false },       "first8": { "label": "first8", "description": "", "type": "string", "required": false },       "given8": { "label": "given8", "description": "", "type": "string", "required": false },       "first9": { "label": "first9", "description": "", "type": "string", "required": false },       "given9": { "label": "given9", "description": "", "type": "string", "required": false },       "author-link": { "label": "author-link", "description": "", "type": "string", "required": false },       "author1-link": { "label": "author1-link", "description": "", "type": "string", "required": false },       "authorlink": { "label": "authorlink", "description": "", "type": "string", "required": false },       "authorlink1": { "label": "authorlink1", "description": "", "type": "string", "required": false },       "author2-link": { "label": "author2-link", "description": "", "type": "string", "required": false },       "authorlink2": { "label": "authorlink2", "description": "", "type": "string", "required": false },       "author3-link": { "label": "author3-link", "description": "", "type": "string", "required": false },       "authorlink3": { "label": "authorlink3", "description": "", "type": "string", "required": false },       "author4-link": { "label": "author4-link", "description": "", "type": "string", "required": false },       "authorlink4": { "label": "authorlink4", "description": "", "type": "string", "required": false },       "author5-link": { "label": "author5-link", "description": "", "type": "string", "required": false },       "authorlink5": { "label": "authorlink5", "description": "", "type": "string", "required": false },       "author6-link": { "label": "author6-link", "description": "", "type": "string", "required": false },       "authorlink6": { "label": "authorlink6", "description": "", "type": "string", "required": false },       "author7-link": { "label": "author7-link", "description": "", "type": "string", "required": false },       "authorlink7": { "label": "authorlink7", "description": "", "type": "string", "required": false },       "author8-link": { "label": "author8-link", "description": "", "type": "string", "required": false },       "authorlink8": { "label": "authorlink8", "description": "", "type": "string", "required": false },       "author9-link": { "label": "author9-link", "description": "", "type": "string", "required": false },       "authorlink9": { "label": "authorlink9", "description": "", "type": "string", "required": false },       "coauthor": { "label": "coauthor", "description": "", "type": "string", "required": false },       "coauthors": { "label": "coauthors", "description": "", "type": "string", "required": false },       "origyear": { "label": "origyear", "description": "", "type": "string", "required": false },       "month": { "label": "month", "description": "", "type": "string", "required": false },       "trans_chapter": { "label": "trans_chapter", "description": "", "type": "string", "required": false },       "trans_title": { "label": "trans_title", "description": "", "type": "string", "required": false },       "type": { "label": "type", "description": "", "type": "string", "required": false },       "archiveurl": { "label": "archiveurl", "description": "", "type": "string", "required": false },       "deadurl": { "label": "deadurl", "description": "", "type": "string", "required": false },       "series": { "label": "series", "description": "", "type": "string", "required": false },       "version": { "label": "version", "description": "", "type": "string", "required": false },       "journal": { "label": "journal", "description": "", "type": "string", "required": false },       "periodical": { "label": "periodical", "description": "", "type": "string", "required": false },       "newspaper": { "label": "newspaper", "description": "", "type": "string", "required": false },       "magazine": { "label": "magazine", "description": "", "type": "string", "required": false },       "work": { "label": "work", "description": "", "type": "string", "required": false },       "volume": { "label": "volume", "description": "", "type": "string", "required": false },       "issue": { "label": "issue", "description": "", "type": "string", "required": false },       "pages": { "label": "pages", "description": "", "type": "string", "required": false },       "page": { "label": "page", "description": "", "type": "string", "required": false },       "at": { "label": "at", "description": "", "type": "string", "required": false },       "nopp": { "label": "nopp", "description": "", "type": "string", "required": false },       "chapter": { "label": "chapter", "description": "", "type": "string", "required": false },       "contribution": { "label": "contribution", "description": "", "type": "string", "required": false },       "chapter-url": { "label": "chapter-url", "description": "", "type": "string", "required": false },       "chapterurl": { "label": "chapterurl", "description": "", "type": "string", "required": false },       "contribution-url": { "label": "contribution-url", "description": "", "type": "string", "required": false },       "chapter-format": { "label": "chapter-format", "description": "", "type": "string", "required": false },       "others": { "label": "others", "description": "", "type": "string", "required": false },       "edition": { "label": "edition", "description": "", "type": "string", "required": false },       "place": { "label": "place", "description": "", "type": "string", "required": false },       "location": { "label": "location", "description": "", "type": "string", "required": false },       "publication-place": { "label": "publication-place", "description": "", "type": "string", "required": false },       "publisher": { "label": "publisher", "description": "", "type": "string", "required": false },       "editor-last": { "label": "editor-last", "description": "", "type": "string", "required": false },       "editor-surname": { "label": "editor-surname", "description": "", "type": "string", "required": false },       "editor1-last": { "label": "editor1-last", "description": "", "type": "string", "required": false },       "editor1-surname": { "label": "editor1-surname", "description": "", "type": "string", "required": false },       "editor1": { "label": "editor1", "description": "", "type": "string", "required": false },       "editor": { "label": "editor", "description": "", "type": "string", "required": false },       "editors": { "label": "editors", "description": "", "type": "string", "required": false },       "editor2-last": { "label": "editor2-last", "description": "", "type": "string", "required": false },       "editor2-surname": { "label": "editor2-surname", "description": "", "type": "string", "required": false },       "editor2": { "label": "editor2", "description": "", "type": "string", "required": false },       "editor3-last": { "label": "editor3-last", "description": "", "type": "string", "required": false },       "editor3-surname": { "label": "editor3-surname", "description": "", "type": "string", "required": false },       "editor3": { "label": "editor3", "description": "", "type": "string", "required": false },       "editor4-last": { "label": "editor4-last", "description": "", "type": "string", "required": false },       "editor4-surname": { "label": "editor4-surname", "description": "", "type": "string", "required": false },       "editor4": { "label": "editor4", "description": "", "type": "string", "required": false },       "editor-first": { "label": "editor-first", "description": "", "type": "string", "required": false },       "editor-given": { "label": "editor-given", "description": "", "type": "string", "required": false },       "editor1-first": { "label": "editor1-first", "description": "", "type": "string", "required": false },       "editor1-given": { "label": "editor1-given", "description": "", "type": "string", "required": false },       "editor2-first": { "label": "editor2-first", "description": "", "type": "string", "required": false },       "editor2-given": { "label": "editor2-given", "description": "", "type": "string", "required": false },       "editor3-first": { "label": "editor3-first", "description": "", "type": "string", "required": false },       "editor3-given": { "label": "editor3-given", "description": "", "type": "string", "required": false },       "editor4-first": { "label": "editor4-first", "description": "", "type": "string", "required": false },       "editor4-given": { "label": "editor4-given", "description": "", "type": "string", "required": false },       "editor-link": { "label": "editor-link", "description": "", "type": "string", "required": false },       "editor1-link": { "label": "editor1-link", "description": "", "type": "string", "required": false },       "editor2-link": { "label": "editor2-link", "description": "", "type": "string", "required": false },       "editor3-link": { "label": "editor3-link", "description": "", "type": "string", "required": false },       "editor4-link": { "label": "editor4-link", "description": "", "type": "string", "required": false },       "language": { "label": "language", "description": "", "type": "string", "required": false },       "in": { "label": "in", "description": "", "type": "string", "required": false },       "format": { "label": "format", "description": "", "type": "string", "required": false },       "arxiv": { "label": "arxiv", "description": "", "type": "string", "required": false },       "asin": { "label": "asin", "description": "", "type": "string", "required": false },       "ASIN": { "label": "ASIN", "description": "", "type": "string", "required": false },       "asin-tld": { "label": "asin-tld", "description": "", "type": "string", "required": false },       "bibcode": { "label": "bibcode", "description": "", "type": "string", "required": false },       "doi": { "label": "doi", "description": "", "type": "string", "required": false },       "DOI": { "label": "DOI", "description": "", "type": "string", "required": false },       "doi_inactivedate": { "label": "doi_inactivedate", "description": "", "type": "string", "required": false },       "doi_brokendate": { "label": "doi_brokendate", "description": "", "type": "string", "required": false },       "isbn": { "label": "isbn", "description": "", "type": "string", "required": false },       "ISBN": { "label": "ISBN", "description": "", "type": "string", "required": false },       "issn": { "label": "issn", "description": "", "type": "string", "required": false },       "ISSN": { "label": "ISSN", "description": "", "type": "string", "required": false },       "jfm": { "label": "jfm", "description": "", "type": "string", "required": false },       "JFM": { "label": "JFM", "description": "", "type": "string", "required": false },       "jstor": { "label": "jstor", "description": "", "type": "string", "required": false },       "JSTOR": { "label": "JSTOR", "description": "", "type": "string", "required": false },       "lccn": { "label": "lccn", "description": "", "type": "string", "required": false },       "LCCN": { "label": "LCCN", "description": "", "type": "string", "required": false },       "mr": { "label": "mr", "description": "", "type": "string", "required": false },       "MR": { "label": "MR", "description": "", "type": "string", "required": false },       "oclc": { "label": "oclc", "description": "", "type": "string", "required": false },       "OCLC": { "label": "OCLC", "description": "", "type": "string", "required": false },       "ol": { "label": "ol", "description": "", "type": "string", "required": false },       "OL": { "label": "OL", "description": "", "type": "string", "required": false },       "osti": { "label": "osti", "description": "", "type": "string", "required": false },       "OSTI": { "label": "OSTI", "description": "", "type": "string", "required": false },       "pmc": { "label": "pmc", "description": "", "type": "string", "required": false },       "PMC": { "label": "PMC", "description": "", "type": "string", "required": false },       "pmid": { "label": "pmid", "description": "", "type": "string", "required": false },       "PMID": { "label": "PMID", "description": "", "type": "string", "required": false },       "rfc": { "label": "rfc", "description": "", "type": "string", "required": false },       "RFC": { "label": "RFC", "description": "", "type": "string", "required": false },       "ssrn": { "label": "ssrn", "description": "", "type": "string", "required": false },       "SSRN": { "label": "SSRN", "description": "", "type": "string", "required": false },       "zbl": { "label": "zbl", "description": "", "type": "string", "required": false },       "id": { "label": "id", "description": "", "type": "string", "required": false },       "ID": { "label": "ID", "description": "", "type": "string", "required": false },       "access-date": { "label": "access-date", "description": "", "type": "string", "required": false },       "accessdate": { "label": "accessdate", "description": "", "type": "string", "required": false },       "laysummary": { "label": "laysummary", "description": "", "type": "string", "required": false },       "laysource": { "label": "laysource", "description": "", "type": "string", "required": false },       "laydate": { "label": "laydate", "description": "", "type": "string", "required": false },       "author-name-separator": { "label": "author-name-separator", "description": "", "type": "string", "required": false },       "lastauthoramp": { "label": "lastauthoramp", "description": "", "type": "string", "required": false },       "display-authors": { "label": "display-authors", "description": "", "type": "string", "required": false },       "archivedate": { "label": "archivedate", "description": "", "type": "string", "required": false }   } } -->