Template documentation follows
Note: the template above may sometimes be partially or fully invisible.
Visit "Template:Cite Q/doc" to edit its documentation if it is available. (How does this work?)

This template, a wrapper for {{Citation}}, returns a formatted citation from statements stored on a Wikidata item (referred to by its Q identifier or QID) describing a citable source such as a scholarly article.

You can read about the template in:

Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.

Note: While Wikipedia does not regard Wikidata as a reliable source, citations using Cite Q are not citing Wikidata; they cite the individual work stated, using metadata about that work, which is held on Wikidata for convenience.

Usage

For example, Wikidata item Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (Q15625490), which uses the Wikidata QID Q15625490, is a scholarly item. To cite this as a source:

{{Cite Q|Q15625490}} →
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.

An example of an article using this template for all of its references is South Pole Telescope; an example using Harvard style citations is Suffix automaton.

By default, if there are more than eight author names, the template displays three, followed by "et al". This can be changed using |display-authors=; setting that parameter to all displays them all. The same applies to multiple editors – see the test-case pages.

You can also use {{Cite Q bulleted}} if you want to have a bullet returned before the citation (useful for automatic lists)

Parameters

|1= = Wikidata QID for the item:

will produce the above citation.

Additionally, any named parameter used in {{citation}} may be entered and will overwrite the value in Wikidata. Using such parameters, with a value of unset, will suppress display of data from Wikidata.

Blank

<ref name="">{{Cite Q|Q00000000}}</ref>

Reference naming

For ease of use, you may wish to name your references to reflect the cited work, for example:

<ref name="Williams-2010">{{Cite Q|Q15625490}}</ref>

Retractions, expressions of concern, and errata

Cite Q will automatically display a notice using the {{Retracted}}, {{Expression of concern}}, or {{Erratum}} templates if the Wikidata item has any of these relations (using the (P5824), (P14891), and (P2507) properties, respectively).

Parameter / entity map

This section lists where each of the template's supported parameters gets its data.

Bibliographic parameters

Identifier parameters

Archival parameters

Thesis parameters

Other parameters

  • |erratum-checked= – passes value to {{Erratum}} parameter |checked=, if invoked
  • |eoc-intentional= – passes value to {{Expression of concern}} parameter |intentional=, if invoked
  • |retracted-intentional= – passes value to {{Retracted}} parameter |intentional=, if invoked

Examples

{{Cite Q|Q15625490}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q15625490|page=42}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q15625490|access-date=18 May 2017}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q15625490|quote=lorem ipsum}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q25766745}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q25766745 |chapter=The Final Cut}} (with chapter specified)
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q25766745 |pages=48-52}} (with pages)
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q15625490|access-date=18 May 2017}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q25766745|mode=cs1}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q25766745|mode=cs2}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q25766745|author-mask=1}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
{{Cite Q|Q25766745|editor=unset}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.

For an example of a bibliography, updated periodically by Listeriabot, see User:Mike Peel/publications.

For additional examples, see testcases and testcases/many names.

Searching

Finding all citations

Citations for specific a work (for example Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (Q106612012)) can be searched using the string insource:Q106612012, resulting in [1].

To avoid most extraneous results (such as this documentation page), use insource:Q|Q106612012 OR insource:Q |Q106612012 (again, without quotes), and limit the namespaces: [2].

Find the Wikidata entry

The Wikidata item for a citation is linked in the content created by this template. Links are not visible in the edit window when using the source editor, but can be seen in previews.

To navigate to the Wikidata entry, copy the QID and search the preview panel or the rendered article to find the link to Wikidata. Alternatively, prefix the QID with d: and place the result in the search bar.

Find errors

Lua error search

Matching existing citation formats

The template used with a single parameter, the QID of the article on Wikidata, will produce a citation using the default display parameters from Template:Citation and the styling of the author and editor names as they are stored on Wikidata. This is rarely the same as required by the citation formatting in any given article. The guidance at WP:CITEVAR requires that editors match the formatting of citations that they add to that of the article where it is added. At present, {{Cite Q}} does not know what style the formatting in an article requires (although it is possible that common styles could be marked or recognised automatically as is done for date formatting).

The result is that editors using {{Cite Q}} must take care to preview their edits and ensure that the formatting rendered matches that of the rest of the article.

The commonest formatting issues are:

  1. Order of first and last names of authors, editors, and translators:
    The determination process, the same for (P98) and (P655), is as follows, taking authors as an example:
    {{Cite Q}} will use the (P1545) qualifier to determine the order when there are multiple authors. It will determine first and last names from the Wikidata item to populate enumerated |author-firstn= and |author-lastn= citation parameters, where the data exists. The names are fetched in the following order:
    Both first and last name qualifiers or properties must be present. Failing that, since there is no way to programmatically determine first and last names from an arbitrary text value, {{Cite Q}} will set an |authorn= parameter using:
    Note that without last names, {{Cite Q}} will be difficult to use with Harvard-style shortened footnotes using {{sfn}}, {{harv}}, and others. A typical output might be:
    • {{Cite Q |Q15625490}} →
    • Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
    If first and last names are missing or incorrect, the best thing to do is fix the data in Wikidata, paying attention to the properties and qualifiers described above. Alternatively, you can specify the |author-firstn= and |author-lastn= parameters in the {{Cite Q}} itself, which will override author data from the Wikidata item. When debugging, it can be valuable to see how {{Cite Q}} has determined the name values by expanding it, to show what is being passed to the actual citation template:
    • {{Cite Q |Q15625490 |expand=yes}} →
    • Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
  2. Punctuation:
    The separators between elements in the above citation is a comma, which is the default for a CS2-style format produced by {{Citation}}. Careful examination in a particular article will often show the separator punctuation to be a full stop (period). That may be selected by setting |mode=cs1:
    • {{Cite Q |Q15625490 |mode=cs1}} →
    • Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
    • Sometimes, the article will have author names with initials, and those initials are terminated with a full stop (period). It may be necessary to manually add or remove the punctuation in the author names to match the style of the target article (note: this does not apply to author-links, which match the title of the author's article):
    • {{Cite Q |Q15625490 |mode=cs1}} →
    • Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
  3. Italicisation in titles:
    Titles drawn from Wikidata cannot contain formatting, so editors using {{Cite Q}} may have to add appropriate formatting.
    {{Citation}} will automatically apply italicisation to titles of books, etc. so that does not need to be added:
    • {{Cite Q |Q25766745}} →
    • Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
    However, some titles require partial italicisation, and that has to be done manually when the whole title is not italicised, although that is rare. Titles of chapters may also need to be checked:
    • For example (from ISBN 978-0-521-32115-0): |chapter= ''Porphyra'' as food: cultivation and economic

Module:Wd

Module:Wd can automatically cause this template to be invoked, e.g.,

{{Wikidata|references|raw|Q2978|P2046|P585=1987-05-25}}

currently causes the following to be invoked:

{{Cite Q|Q15707237|pages=242}}
Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.

because an Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (P2046) statement on Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (Q2978) is referenced to be Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (P248) Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (Q15707237) with Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (P304) = 242.

Error messages

Missing first/last names

Missing first/last names in Wikidata for [list of names]
Category:Cite Q - authors with missing given and family names
Category:Cite Q - author name strings with missing given and family names

This error appears when {{Cite Q}} is unable to determine either (or both) the given name or family name for one or more of the authors, editors or translators on the cited Wikidata item.

Resolution
This is best fixed once in one place, i.e. in Wikidata itself.
  • In cases where there is already a Wikidata item for the person, an edit button will appear after the name that will let you edit the person item directly, e.g. Jane Doe File:Edit icon on Wikisite.svg
For these items (values of (P50), (P98), and (P655) fields), this error occurs because one or both of their (P735) or (P734) fields are missing. Simply click the button to edit the item for that person, and add or update these fields. Use the qualifier (P1545) to ensure the correct sequence of given names (the NamePrefiller.js user script helps here). Occasionally, it may be necessary to create a new Wikidata item for a new or unusual value of given or family name, if the name's item does not yet exist in Wikidata (another user script NewNameCreateLink.js helps for this action).
  • If the edit button does not appear after a name, it is because it is a value in the (P2093) field. Firstly, search Wikidata for an existing person by that name, taking great care to ensure that they are indeed the correct person; a little sleuthing using their VIAF, LCCN, or other bibliographic fields helps here.
    • If found, add that person item as a new value in the (P50) field, and remove the corresponding value from (P2093).
    • If not found, consider creating a new item for the person.
The userscript author strings.js helps with these steps.
As a last resort, add the qualifiers (P9687) and (P9688) to the author name string value (NamePrefiller.js can help with this too). However, doing so will only resolve the name error for this one citation, whereas editing the person item will correct all of their citations at once, wherever this person is linked to items representing any of their works.


Citeref does not match default

Supplied |ref=[CITEREFSupplied] does not match value generated from Wikidata: [CITEREFDerived]
Category:Cite Q - supplied citeref does not match

This error occurs when a |ref= value is supplied, and names for authors and/or editors are determined from the cited Wikidata item, i.e. not supplied via parameters to {{Cite Q}} using |author-lastn=, |editor-lastn=, and so on. It indicates that the supplied |ref= value does not match the citeref value that the underlying CS1 template generates using the name data from Wikidata. It may be that the Wikidata item was corrected or updated; item fields that affect the citeref value are the first four author's last names, and the year of the publication date.

Resolution
This may or may not be caused by the missing name error described above, so if that error is also flagged, fix it first.
Depending on the situation, either update the |ref= parameter value in the {{Cite Q}} citation to use the calculated value, or remove the |ref= parameter. It may also be worth checking that the details are correct on the Wikidata item.

Currently, if {{Cite Q}} is used without supplying values for |author-lastn= and |date=, or without a |ref=, CS1 will emit false positive "sfn error: no target" errors, which need to be flagged using {{sfn whitelist}}. Supplying a |ref= serves as a useful hint to markup viewers and editors about what the {{Cite Q}} citation is. This is especially useful when using Harvard short form footnotes throughout the article with the {{sfn}} and {{harv}} family templates. If the supplied |ref= value matches the Wikidata value, the ref will not be passed to CS1, thus avoiding the CS1 "ref duplicates default" error, and also sidestepping the need for whitelisting.

Issues

Future developments

  • Once robust the functionality should be merged into {{Citation}}
  • Eventually, each signed-in reader should be able to set, under their "Preferences", the style in which they wish to see citations rendered. No more CiteVar wars!
  • We should have a global template repository, so the code can be used by multiple wikis, without having to manually copy it after every update.

To do list

Deferred

Feel free to tackle these; the core team working on Cite Q sees them as low priority, or too complex.

  • Resolve special case of newspaper articles
    • Is the following topic of "hint parameters" related to this?
  • Author names (Western-style, at least) should display as "Last, First Middle" to match Wikipedia house style — this is done where the data exists (see above), but the following are still to do:
    • How to deal with Tussenvoegsels etc.
      • In Romance languages, it should be, e.g., "Quental, Antero de" instead of "de Quental, Antero"
    • How to deal with items with multiple authors with mixed (P50) and (P2093), missing first/last qualifiers, etc. — notify the user with some red text like Trappist's Harvard errors script?
  • Handle volume in a serial
    • Clarification needed: What is meant by this? |part=, or output format differences journal vs. magazine?
  • Is there a Pxxxx code for book series editors to add them to the list of "normal" editors?
    • resolve at Wikidata first

Done

Won't fix

  • Improve date formatting options
  • Fix unnecessary piping of author/editor and journal links if link and label are the same, f.e. [[Author|Author]] -> [[Author]], [[Journal|Journal]] -> [[Journal]] for improved reusability, cleaniness of output, reduced size of resulting page code, and to avoid potential future extra text errors thrown by the underlying {citation} template
    • See talk
  • Fix invocation with |qid= instead of unnamed parameter. At present {{cite Q|qid=Q12345}} instead of {{cite Q|Q12345}} gives an error.
    • This is intended; please discuss on talk
    • Fix ready for test in template sandbox: {{cite Q/sandbox|qid=Q15625490}} gives Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
  • Replace the QID with a pen icon
    • The QID is valid metadata about the cited work.
  • Consider case where author is given as Lua error in Module:Wd at line 633: attempt to index field 'wikibase' (a nil value). (Q311624)
    • If last author/editor is named "et al." (and variants), mute this entry and set display-authors/editors=etal instead before passing down to {citation}
  • Improve rendering when both (P50) and (P2093) are present.
    • Example: {{Cite Q|Q108740476}} → Lua error in Module:Deprecated at line 18: assign to undeclared variable 'warn'.
    • Current rendering of author name uses semicolon: “Camelia-Manuela Lățăianu; Manuela Lataianu”
    • Suggested improved rendering of author name: “Manuela Lataianu [= Camelia-Manuela Lățăianu]”
    • Such instances should be fixed on Wikidata, as done here

Tracking categories

See also

Notes

Template data

Generate citations from Wikidata by passing the QID to this template

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
QID1

The Wikidata QID of the cited source (this value can also be the URL to the Wikidata item)

Stringrequired
Authorauthor

Use for Last, First format

Example
Prymachenko, Maria
Stringoptional
Author Linkauthorlink

Wikipedia article title, use with Author

Example
Maria Prymachenko
Stringoptional
Pagespages

Page number(s)

Example
42–49,55
Stringoptional


Cite error: <ref> tags exist for a group named "lower-alpha", but no corresponding <references group="lower-alpha"/> tag was found