Citoid/Enabling Citoid on your wiki

The citoid node.js service generated citation data given a URL, DOI, PMID, or PMCID. It has a companion extension, Citoid, which aims to provide use of the citoid service to VisualEditor. It is currently deployed in all VisualEditor-enabled WMF-Wikis,  though the extension is only configured on a few of them.

Citation tool
To enable the citoid service for your WMF wiki, you first need to enable VisualEditor's Citation Tool, if that hasn't already been done.

Configure Citoid on a Citoid-enabled wiki
The citoid extension must be configured using special TemplateData maps and a special citoid-specific message. It is currently deployed in all VisualEditor-enabled WMF-Wikis, but it must be configured before it can be used.

Example of TemplateData skeleton with empty maps value
Below, a barebone example of templateData that shows you how the 'maps' key fits in with the rest of the templateData. 'maps' values correspond to the name of the service being used, in this case 'citoid.'. The values in the citoid object must be valid 'params' (i.e. in this case, 'foo' - aliases are not allowed); 'maps' keys, i.e. 'bar' here, correspond to keys coming from the citoid service.

Real example
This is an example of a partial 'maps' value from the Cite web template on en wiki. The full templateData can be viewed on the page source.

Configure special MediaWiki namespace Citoid message
You'll need to configure a special MediaWiki: namespace message, MediaWiki:Citoid-template-type-map.json. This message maps the native citoid types (website, book, journalArticle) to the appropriate template (Cite web, Cite book, Cite journal). You should match a template to every single citoid type; there is no default behaviour if no template is matched to a particular type. It's better to have a bad match (there may be some fields in common between video liner notes and a book, or video liner notes and a video, for example) than none at all.

You may consider using en wiki's Template:Citation as a catch-all for types where there is no good type match as it is designed for this situation.

A sample namespace message is found here: Citoid/MediaWiki:Citoid-template-type-map.json

Ensure each template specified in MediaWiki:Citoid-template-type-map.json has a 'citoid' maps value
Since Citoid has its own set of fields for each document type (for instance, the journal name is called 'publicationTitle' in citoid, but 'journal' in Template:Cite_journal), each Template must have TemplateData defined that creates a map between citoid's fields and the Template's field. Calling the map 'citoid' lets the citoid extension know which map to look for. If the map 'citoid' doesn't suit your purposes for use with say, a userscript, you may create a citoid service related map that is called something else; an unlimited number of maps with unique keys are allowed in the maps object. Note that you can only see TemplateData maps in edit mode; they are not visible in the TemplateData table.

The most up-to-date maps objects that are compatible with the citoid extension are on beta:
 * http://en.wikipedia.beta.wmflabs.org/wiki/Template:Cite_news/doc
 * http://en.wikipedia.beta.wmflabs.org/wiki/Template:Cite_journal/doc
 * http://en.wikipedia.beta.wmflabs.org/wiki/Template:Cite_web/doc
 * http://en.wikipedia.beta.wmflabs.org/wiki/Template:Cite_book/doc
 * http://en.wikipedia.beta.wmflabs.org/wiki/Template:Citation/doc

Troubleshooting

 * Main: Citoid

The new cite button does not appear in the toolbar
The previous cite drop-down menu should be replaced by a new button for the inspector in the toolbar menu. If the icon does not appear in the toolbar, it most likely means there's a problem with MediaWiki:Citoid-template-type-map.json. If there is no message at that location, or if the JSON is invalid, the inspector will not load. Alternatively, you may need to refresh your JavaScript cache.

Empty references appear
Empty references most commonly appear when the citation template being inserted contains no maps data, or if the maps data is there but not making it to the MediaWiki API. If the maps object is present in TemplateData, but not in the API response, try making a "null edit" on the template. If the response from the API looks okay, there may be an issue with the map itself.

My favourite site isn't recognised by citoid and only gets basic information

 * Main: Citoid/Determining if a URL has a translator in Zotero

The citoid service relies on the brilliant Zotero community for much of the "magic". We use Zotero translators to convert a page link into detailed information. These Zotero translators need to be written for each site. You can see a list of all Zotero translators at https://github.com/zotero/translators Right now, Zotero mostly supports English-language sources. We need your help to improve coverage of other sites. You can write your own Zotero translator. Start by looking at an existing translator for a similar website and by reading the general development framework instructions at https://www.zotero.org/support/dev/translators/framework.