Jump to content


From Meta, a Wikimedia project coordination wiki
(Redirected from Meta:AutosuggestSitelink)

AutosuggestSitelink is a gadget that suggests Wikidata items for possible linking with a Wikimedia site page, using interwiki linking. It was created by the Community Tech Wishathon, based on Community Wishlist Survey proposals from 2022 (#13, Autosuggest linking Wikidata item after creating an article) and 2023 (#96, Popup to link to or create a new Wikidata item after creating an article). It is still in development as of April 2024.

Overview of functionality[edit]

As explained in Wikidata:Wikipedia and Help:Sitelinks, Wikidata sitelinks are used in the maintenance of interlanguage links, the insertion of Wikidata information into wiki pages, and in other ways. AutosuggestSitelink exists to facilitate the creation of these sitelinks, without requiring the user to leave the wiki on which they're editing.

The gadget comprises dialog window that opens in two situations: directly after editing a page that is not yet linked to Wikidata; and when the user clicks the AutosuggestSitelink link in the tools menu.

When launched, AutosuggestSitelink searches Wikidata for items that might be appropriate for linking to a Wikipedia article (or other site page). The search is based on the title of the page just edited. If candidate items are found, the search results list allows quick creation of a new link with an item chosen by the contributor (each item has a radio button with which to select it). A link is also provided allowing for the creation of a new Wikidata item, in case there are no search results or if none are appropriate.

AutosuggestSitelink does not determine the appropriateness of any Wikidata item for linking to the article. Before linking to an item, it is important for the contributor to verify its appropriateness. If appropriateness cannot verified, it is better not to make the link. This is true even if AutosuggestSitelink returns just a single candidate item.

Before creating a new Wikidata item, the contributor should verify that an appropriate item does not already exist. This should be done even if AutosuggestSitelink has reported that no matches were found.

Some general guidelines for Wikidata sitelinks are given in Help:Sitelinks.


AutosuggestSitelink is triggered when a contributor publishes changes to a content page in a wiki (e.g. a Wikipedia article). If no changes are made (i.e. a null edit) then it is not triggered. On being triggered, the following logic is followed:

  • If the article is already linked with a Wikidata item, AutosuggestSitelink does nothing.
  • Otherwise, AutosuggestSitelink searches for candidate Wikidata items for linking.
    • If no search matches are found, the contributor is given an opportunity to create a new Wikidata item corresponding to the article just edited. Before doing this, the contributor should determine that no such Wikidata item currently exists, as discussed above.
    • If search matches are found, they are presented in a list. Before making a selection, the contributor should determine which, if any, of the listed items represents the main subject of the article, as discussed above.  Once an appropriate Wikidata item has been identified in the list, the contributor can link to that item by selecting it and then clicking Publish.
      • Linking to an item is optional. If the contributor prefers not to create a link, they may simply close the dialog.


Installing globally (recommended)[edit]

  1. First, make sure you are registered and logged in. Only logged-in users can install user scripts.
  2. Click here to edit your global.js file.
  3. Add the following lines (This code will check if the local wiki has a gadget also named AutosuggestSitelink):

    if ( mw.loader.getState( 'ext.gadget.AutosuggestSitelink' ) !== null ) {
        mw.loader.load( 'ext.gadget.AutosuggestSitelink' );
    } else {
        mw.loader.load( 'https://meta.wikimedia.org/w/load.php?modules=ext.gadget.AutosuggestSitelink' );

  4. Save the page and bypass your cache to make sure the changes take effect.

Installing as a gadget[edit]

Individual wikis may install AutosuggestSitelink as a local gadget, but this is not yet recommended while we add finishing touches. Installing globally is always recommended for individual users, so that the tool is available on all wikis.

If you are an interface administrator and would like to install AutosuggestSitelink as a gadget on your wiki, follow these steps:

  1. Create MediaWiki:Gadget-AutosuggestSitelink-local.js with the following:
  2. Add the following to MediaWiki:Gadgets-definition:
  3. Add a description for the gadget at MediaWiki:Gadget-AutosuggestSitelink-local, preferably linking to this page ([[meta:AutosuggestSitelink]])


Please report any issues either on the talk page here, or on Phabricator with the #AutosuggestSitelink project.


2024 April 26
Although it has been available for some months, and tested by a number of people (thank you all!), AutosuggestSitelink is now ready for more wiki editors to test it. Community Tech invites anyone interested to install it and use it to connect wiki pages to Wikidata. Please report any issues you have.


User interface messages are stored in MediaWiki:Gadget-AutosuggestSitelink-messages and can be translated in the normal way of wiki pages.

The source code for the gadget is maintained on GitLab at gitlab:repos/commtech/autosuggest-sitelink, and is deployed to MediaWiki:Gadget-AutosuggestSitelink.js when a new version is released.

See the README for more information about how to contribute.