Jump to: navigation, search
Citoid in VisualEditor

Citoid is a node.js service which currently locates citation data given a URL, DOI, PMID, or PMCID. It has a companion extension of the same name which aims to provide use of the citoid service to VisualEditor. It is currently deployed in all VisualEditor-enabled WMF-Wikis.[1]

Public API[edit | edit source]

To request metadata about a URL, DOI, PMCID or PMID, you can use the API endpoint at and provide a GET request with the required parameters "search" and "format".

The "search" parameter takes as value the URL-encoded URL, DOI, PMCID or PMID.

The "format" parameter takes the values "mediawiki", "bibtext", "zotero", and "mwDeprecated".

An example request is

Issue tracker and project management[edit | edit source]

Bugs, issues, and suggestions for improvement can be added to the Citoid phabricator project.

Installation[edit | edit source]

Before installing, check to see whether the URLs that are popular on your site are already available in Zotero. If they're not, then you will need to create Zotero translators for your popular sites first.

Citoid is a nodejs app that also requires a working installation of Zotero's translation server, which uses the Zotero translators library, and xulrunner. Please note that the most recent version of xpcshell doesn't work with translation-server; the latest version known to work is 29.0.

Install nodejs and npm[edit | edit source]

Install nodejs 0.10 and npm. When you are using Ubuntu and depending on OS version you will not end up with the most recent version of nodejs.

sudo apt-get install nodejs npm
nodejs --version # should now print v0.10.x Note: not on Ubuntu Server 12.04 LTS, you end up with v0.6.x

For other systems, see:

Install from scratch[edit | edit source]

Install and configure Zotero's translation server[edit | edit source]

See: Translation-server installation instructions

Note: The most recent version of xpcshell does not work with translation-server. Install version 29.0.

Install and configure citoid service[edit | edit source]

Get the code[edit | edit source]

If you want to do an anonymous checkout:

git clone

Or if you plan to hack citoid, then please follow the Gerrit 'getting started' docs and use an authenticated checkout url instead, such as:

git clone ssh://<user>
JS dependencies[edit | edit source]

Install the JS dependencies. Run this command in the citoid directory:

npm install
Create localsettings.js file[edit | edit source]

Copy localsettings.js.sample to localsettings.js

cp localsettings.js.sample localsettings.js
Run the server[edit | edit source]

You'll first need to run translation-server; see the directions on its github page, but generally you should run:


You should be able to start the citoid web service from the citoid directory using:

node server.js

This will start the citoid service on port 1970. To test it, try a sample query:

curl -d '{"url":"", "format":"mediawiki"}' --header "Content-Type: application/json" localhost:1970/url

Install and configure Citoid user scripts[edit | edit source]

Users can make use of citoid user scripts if user javascript is enabled on your wiki using the $wgAllowUserJs option. You can also install VisualEditor gadgets on a site-wide basis.

There is one user script for wikitext editing that can be used on English Wikipedia, also using the labs instance: Citoid Wikitext citations.

Install and configure Citoid extension[edit | edit source]

In order to have citoid functioning on your wiki in conjunction with VisualEditor, you'll need the following: VisualEditor and Parsoid, VisualEditor's Citation Tool, and the Citoid extension.

It is recommended that you have the following extensions in your extension folder: Extension:VisualEditor, Extension:Scribunto, Extension:Cite, Extension:TemplateData, and Extension:ParserFunctions, and Extension:Citoid.

VisualEditor and Citation Tool[edit | edit source]

  1. Set up MediaWiki: Manual:Installation_guide
  2. Set up Parsoid: Parsoid/Setup
  3. Set up VisualEditor: Extension:VisualEditor
  4. Set up Citation Tool: VisualEditor/Citation tool

Citoid extension[edit | edit source]

If you want to do an anonymous checkout:

git clone

Or if you plan to hack citoid, then please follow the Gerrit 'getting started' docs and use an authenticated checkout url instead, such as:

git clone ssh://<user>

Then add the following line to your wiki's LocalSettings.php after you have downloaded the extension:


Set the location to your citoid service instance in your wiki's LocalSettings.php

// If the wiki is being served over https, the https 
// protocol is required in the citoid service url; otherwise the 
// browser will block the request.
$wgCitoidServiceUrl = 'http://localhost:1970/api';

Configure special MediaWiki namespace Citoid message[edit | edit source]

You'll need to configure a special MediaWiki: namespace message. 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.

An 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 an 'citoid' maps value[edit | edit source]

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:

Troubleshooting VisualEditor Extension[edit | edit source]

Inspector does not appear in the toolbar[edit | edit source]

An icon for the inspector should appear 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[edit | edit source]

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. First, determine the template that the inspector is attempted to insert, for example, Template:Cite web/doc. View source of the template or documentation page to verify that

"maps": {

    "citoid": { 

is present and contains fields. Then verify that these data are making it to the MediaWiki API by visiting the API page, i.e. http://localhost/api.php?action=templatedata&titles=Template:Cite%20web/doc&format=jsonfm.

If the maps object is present in TemplateData, but not in the API response, try editing the template where the TemplateData is transcluded i.e. Template:Cite_web (but making no changes) and saving it, a.k.a. a "null edit". There is a known bug with transcluded TemplateData where it can take a long for the API to update; null edits force the change.

If the response from the API looks okay, there may be an issue with the map itself.

The inspector is still "pending" after a really long time following insertion[edit | edit source]

This typically means there is a bug. If you open your JavaScript console, you will likely find error messages that will help you debug.

My favourite site isn't recognised by citoid and only gets basic information[edit | edit source]

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, and these translators need to be written for each site. You can see a list of all Zotero translators at – right now it is best for English language sources, and we need your help to improve coverage of other sites. Starting from one of the existing translators, and the general development framework instructions at, should help you write your own Zotero translator, which we would love you to contribute back to the wider Zotero community.

Related extensions and services[edit | edit source]