Jump to content

User:Citation bot/use

From Wikipedia, the free encyclopedia
The citation expander gadget adds a button to trigger the bot from the edit window! This button will work even if the bot is blocked.
It also adds an "Expand citations" link in your toolbar!

These are only two of the many ways to activate the bot.

Citation bot is a piece of software designed to expand and fix citations on Wikipedia, making referencing easier. This guide will help you get the best results with Citation bot. There is no need to painstakingly enter and copy-paste author names, date, source titles, and page numbers anymore. Now you can type or paste in only the DOI, PMID, S2CID, or, the Google Books URL, and let the bot do the rest! It will also try to fix a variety of common errors with existing citations, and tidy them up as best it can.

See simple cases below to quickly see how to get the most out of Citation bot. See also how to deal with mistakes.

How to activate Citation bot[edit]

Note: Most methods of activating the bot will require a valid user account that has granted the Citation Bot permission to authenticate using OAuth (the bot will prompt for this). One exception to this is the Citations button of the citation expander, which will work right away, and which is also the only method that will work if the bot is blocked.

via the web interface[edit]

The bot can be activated directly at https://citations.toolforge.org/. There will be a few options, including the ability to run the bot on all articles in a category (use with care, as those could be very numerous).

via templates[edit]

Certain templates will give links to activate Citation bot automatically (and possibly other tools). This may look like

Easy tools: Citation bot (help) | Advanced: Fix bare URLs

Simply click on the Citation bot link and you're done!

As of writing, the following templates will present editors with Citation bot links:

AFC/Draft templates
Citation templates
Tool templates

via the citation expander gadget[edit]

To enable the citation expander gadget, go to your preferences and click on the "Gadgets" tab. Scroll down to the "Editing" section, and tick the "Citation expander" box. Then scroll down to the bottom of the page and click "Save". There are minor incompatibilities with wikEd.

Once you have done this, two things will happen (see image in top right).

  1. There will be a Citations button below the editing window between the Show changes and Cancel buttons (the exact appearance may differ). Clicking on the button will initiate the bot. The bot will then complete/fix references and return you to the article edit box. Above this box you will see a "diff" of the page as it looked before (on the left) and after (on the right) the bot examined it. If no changes were made then you will see the words "No difference" in parentheses above the edit box.

    You can now review the changes and edit normally. Once you are happy with the results, click Save changes, and you're done!

  2. There will be an "Expand citations" link in your toolbar (normally on the left when editing from a desktop/laptop) where the bot can be activated directly. The bot will present a summary log and save its changes automatically, if any are made. If the log is too complex for you, scroll down to the bottom, and there will be a final line
    Written to Page [diff link] (if a change is made)
    > No changes required. (if no change is made)
You can then click on 'diff' to review the changes the bot made.

via user scripts[edit]

For advanced users. Most people should use the Citation expander gadget instead. Examples of user scripts would include


Simple cases: DOI / GoogleBooks [edit]

To add a reference to a peer-reviewed article with a digital object identifier (DOI), simply type

<ref>{{cite journal |doi=10.2222/B22.2}}</ref> or <ref>https://doi.org/10.2222/B22.2</ref>

where you want to insert a citation (copy and paste your own DOI code from wherever you are getting your reference). Other identifiers are also supported.

Likewise, to add a reference to a book you have found on Google Books, just type

<ref>{{cite book |url=https://books.google.com/...}}</ref> or <ref>https://books.google.com/...</ref>

where you want to insert a citation. Other websites are also supported.

You can add multiple such references at once if you want. Now simply save the page and activate the bot!

Supported identifiers[edit]

More than just DOIs are supported in citation templates.

For arXiv preprints, use

For books, use

For conference proceedings with DOIs, use

For journals, use any of

and run the bot as usual. For example {{cite journal |doi=10.1093/bioinformatics/btl302}} gets converted to

  • Rebholz-Schuhmann, D; Kirsch, H; Arregui, M; Gaudan, S; Riethoven, M; Stoehr, P (2007). "EBIMed--text crunching to gather facts for proteins from Medline". Bioinformatics. 23 (2): e237–e244. doi:10.1093/bioinformatics/btl302. PMID 17237098.

Note that you might still need to review for errors or style in some cases, to produce the desired

  • Rebholz-Schuhmann, D.; Kirsch, H.; Arregui, M.; Gaudan, S.; Riethoven, M.; Stoehr, P. (2007). "EBIMed—text crunching to gather facts for proteins from Medline". Bioinformatics. 23 (2): e237–e244. doi:10.1093/bioinformatics/btl302. PMID 17237098.

Supported URLs[edit]

The bot will convert select raw URLs when placed between <ref>https://...</ref> to the correct citation templates. This is particularly useful if you don't want to figure out which template is best to use, or what exactly the identifier is, or if just want to save yourself a few keystrokes. Like above just save the page and you can set the bot on it. The supported URLs and conversions are:

  • https://arxiv.org/...{{cite arXiv|arxiv=...}} (or → {{cite journal|arxiv=... |doi=...}} if a doi is found)
  • https://books.google.com/...{{cite book|isbn=...}}
  • https://adsabs.harvard.edu/...{{cite journal|bibcode=...}}
  • https://doi.org/...{{cite journal|doi=...}}
  • https://www.jstor.org/stable/...{{cite journal|jstor=...}}
  • https://www.ncbi.nlm.nih.gov/pubmed/...{{cite journal|pmid=...}}
  • https://www.ncbi.nlm.nih.gov/pmc/...{{cite journal|pmc=...}}
  • Most Semantic Scholar URLs, such as https://www.semanticscholar.org/paper/...; still, the bot code limits the use of this type of URL, since many of these URLs only lead to a landing page with a DOI link out—the bot only converts raw Semantic Scholar URLs to a {{cite journal|doi=...}} article when such article at Semantic Scholar has useful content not available otherwise. An example of such useful content is the article's full-text PDF;

Note that this will usually not work on URLs with formatting, like <ref>[https://doi.org/... Smith, J. (2006) "Article of Stuff" ''Journal of Stuff'']</ref>. To convert those to citation templates, simply remove the formatting (<ref>https://doi.org/...</ref>) before running the bot.

You can also use the identifiers URLs in templates, rather than the identifier code. For example, instead of

<ref>{{cite journal |jstor=650874}}</ref>

you can add

<ref>{{cite journal |url=https://www.jstor.org/stable/650874}}</ref>

and the bot will work as usual.

Other URLs to large repositories like Academia.edu, ResearchGate, ScienceDirect, SpringerLink or Wiley Online Library, will often (but not always) work too.

Additional fixes[edit]

The bot will also attempt to make things right en masse on already-present citations and correct a range of common errors from misspelled parameters (|Year=|year=), to capitalization mistakes (|journal=JOURNAL OF PHYSICS|journal=Journal of Physics), to the wrong template being used ({{cite web}}{{cite book}}).

What happens when...[edit]

... the bot is blocked?[edit]

Occasionally the bot is blocked due to bugs that the maintainer has not had time to fix. When this happens, the bot itself cannot commit edits, but you can still install its changes by hand. However, you should take special care when this occurs, as the bot-induced bugs are not always obvious. Sometimes, for example, the bot might break wikilinks to a citation, and this will not be easily observable simply by reading the resulting citation.

If the bot is blocked, you can still use the "Citation bot" button, if you have the widget installed. Just be doubly sure to check that you are not introducing errors.

... no changes are made by the bot?[edit]

New users; please note that the results when no changes are made can be confusing. You will see this at the top of the page:

Latest revision _______ Your text.

Followed immediately by the edit window. That means that no changes have been made. If you save the page hoping for some improved citations, you will see no changes, and nothing will show up in the revision history.

If you click Citations and there are changes made, the bot will show them to you before they are saved. It is very clear. This allows you to choose whether to make further changes before saving.

... the bot made a mistake?[edit]

Many bot mistakes will be due to poor template usage. First consult the documentation to make sure you are using the templates correctly (for example, if there's an issue with how the bot deals with {{cite journal}}, look at the documentation found at Template:Cite journal). If this is intimidating, you can ask for help at the citation template help page and someone will help you figure things out. The bot does however make genuine mistakes. Most will occur because of bad metadata, which can be dealt with using the below methods. However some will occur because of bad bot logic, in which case you should report the bug.

When dealing with bad metadata, or when the bot keeps repeating a mistake, you can prevent the error from happening again with the following methods:

  • If the bot messes a specific parameter, like change a correct |pages=13-45 to |pages=#Chemistry;%34, put a comment in it (any comment will do)
|pages=13-45<!-- Deny Citation Bot-->
This will prevent the bot from overwriting the parameter. This is usually due to bad metadata. If it is a bug however, please report it!
  • If the bot adds an inappropriate parameter, like |last3=Corporation, Inc. |first3=Acme, put a comment in the bad parameter
|last3=<!-- Deny Citation Bot--> |first3=<!--Deny Citation Bot-->
This will prevent the bot from re-adding the parameter. Again, this is usually due to bad metadata. If it is a bug however, please report it!
  • If the bot messes an entire citation, for instance if it inappropriately converts a {{cite journal}} to a {{cite book}}, put a comment in the template name
{{cite journal <!--Deny Citation Bot-->| ... }}
This will tell the bot to not touch this citation at all. Again, this is usually due to bad metadata. If it is a bug however, please report it!
  • This bot does not use {{cbignore}}, despite the name being similar.

... you have a suggestion?[edit]

If you have an idea for how the bot can be even more helpful, please bring it up here.

See also[edit]