User:Danny Benjafield (WMDE)/sandbox
![]() | This is the user sandbox of Danny Benjafield (WMDE). A user sandbox is a subpage of the user's user page. It serves as a testing spot and page development space for the user and is not an encyclopedia article, or data item. For a sandbox of your own, create it here. Other sandboxes: Main sandbox | Tutorial sandbox 1, 2, 3, 4, 5 |
handy links - MediaWiki Documentation
![]() | This page in a nutshell: Sitelinks are special links that contain a site and a page title, and go from individual items in Wikidata to pages on Wikimedia projects. |
![](http://upload.wikimedia.org/wikipedia/commons/thumb/1/18/WD-sitelinks2.0.png/330px-WD-sitelinks2.0.png)
What are Sitelinks
editSitelinks are special links that connect a Wikidata item with another Wikimedia project page. They allow easy navigation between language versions of an article or page on the same concept, using a linked Wikidata item as a central hub. Sitelinks replaced the local, on-wiki links system referred to as interwiki links or interlanguage links.
Sitelinks populate the "In Other Languages" section, allowing reader's to switch to a corresponding page in their preferred language (or any other that is sitelinked). Of course, there is no guarantee that the page content will be the same as every language community is responsible for writing their pages. However, this does allow editor's to cross-reference content between different versions and update their page accordingly.
Navigation
editSitelinks are bidirectional links, creating a two-way connection between the Wikidata Item and the linked page. On Wikidata, the link will be stored under the relevant Project header (Wikipedia, Wikibooks, Wikinews and so on...). On the linked page, a 'Wikidata Item' button will appear in the Tools sidebar.
Unique
editEach Wikidata item can only have one sitelink to each Wikimedia project language version. There can be a sitelink from Douglas Adams (Q42) to the English and German Wikipedia, but not to two different English Wikipedia pages. The linked page can be an article, Help:, Special: or many other types of namespace) pages.
Consistent and Synchronized
editEditor's can refer to other language versions and the Wikidata item to check the completeness of their article, they might discover new content from another version to translate or use statements from the Wikidata item. Adding, editing or removing a sitelink will update in real-time. The change will be reflected wherever that link can be found.
Queryable
editSitelink locations can be tracked, which allows better analysis of knowledge gaps and where articles and content is missing in different projects.
How do Sitelinks work?
editIf an editor clicks 'Add sitelink' under the Wikivoyage section of the Sitelinks area for the Wikidata Item Berlin (Q64), this enforces the domain of the sitelink to .wikivoyage.org/.
They will then be asked to enter the language code (ISO 639-1 or ISO 639-3) of the language-version of Wikivoyage to link to. Entering the language code will open a dropdown list to select the matching language version of that Wikimedia project.
How to add a Sitelink?
editThere are a few ways to add a sitelink, depending from where you are adding it and which Preferences you have set.
From the Wikidata Item
edit- Find the Wikidata item you want to sitelink to / from.
- Click the edit / pencil icon in the appropriate Sitelink section (Wikipedia, Wikivoyage, Wikisource, etc.)
- If there are already sitelinked pages, scroll to the bottom of the list.
- In the first input box (with placeholder text 'wiki') enter the language code of the target Wikipedia / Wikimedia project. A dropdown menu will appear with the language name, click to confirm.
- If the target language version is already sitelinked, it will not appear in the dropdown.
- If you enter a partial, you will be shown all partial-matching language versions available based on your entry. Entering 'y' in the Wikipedia section will display results for Yiddish (yi) and Yorùbá (yo) - if neither of these pages are already sitelinked.
- A new input field will appear (with placeholder text 'age'), enter the page title of the target article / page.
- To confirm and publish the sitelink, click the tick (tick symbol) on the Section header.
From a Wikimedia project (e.g. Wikipedia)
edit(This process may vary depending on the Skin and Wikimedia project you are using)
Vector 2010
- Click 'Add Links' from the Languages in the sidebar.
- You will be forwarded to the Wikidata item
- Follow the steps described above for adding from the Wikidata item (anchor link)
EN Wikipedia
- Click 'Add Links' from the Languages in the sidebar.
- A popup will appear with 2 input fields: Language and Page.
- Language: Begin typing the language code or language name, a dropdown will appear showing matching and partially-matching options, click to select.
- Page: Enter the title of the page to link to.
- Click the 'Link Page' button to confirm.
Vector 2022
- Open the languages dropdown
- Click 'Add Other Languages'
- You will be forwarded to the Wikidata item
- Follow the steps described above for adding from the Wikidata item (anchor link)
Language-independent general principles
editUsage
editTypically items have at least one corresponding page on a Wikimedia site such as Wikipedia, Wikivoyage, Wikisource, Wikiquote, or Wikimedia Commons (however, there are some exceptions to this rule). Having at least one sitelink ensures that an item meets Wikidata's notability criteria. Sitelinks are also useful for ensuring that items in Wikidata represent only one unique concept. In cases when more than one item could reasonably correspond to the same Wikimedia page, it is likely that the items should be merged together.
Sitelinks serve as a replacement for a previous system of interlanguage links that was used to link from a page in one language on a Wikimedia site to an equivalent page in another language, for example the English Wikipedia page on Paris to the French Wikipedia page on Paris. These interlanguage links used to be stored locally on each Wikimedia site and maintained separately in each language so that if the name of a page on one Wikimedia site changed, then the other Wikimedia sites in each language would need to have their links updated to reflect the changes. Sitelinks thereby improve upon this system by having everything centralized in Wikidata. Sitelinks can have attached badges and will usually show that a page has been a featured article, or of similar status.
Linking to Wikimedia site pages
edit
Wikidata currently supports sitelinks for most Wikimedia projects (except Incubator, see phab:T54971). The site id for English Wikipedia is enwiki, for French Wikipedia frwiki and so on and for Commons commonswiki. The site id for English Wikimedia projects are enwikinews, enwikiquote, enwikisource, enwikivoyage etcetera.
Sitelinks are for linking items to standalone pages that already exist on Wikimedia sites. Wikidata sitelinks do not support anchors (links to a specific section of a page). Anchors are preceded by the "#" character on Wikimedia sites.
For example, a sitelink for the item for The Beatles (Q1299) should only link to the Wikipedia page on The Beatles (https://en.wikipedia.org/wiki/The_Beatles) — and not any sections of that page, such as https://en.wikipedia.org/wiki/The_Beatles#Discography. Moreover, it's not possible for any item on Wikidata to link to just the Discography section of The Beatles page because this would require an anchor link. However, it would be possible to link a different item, The Beatles discography (Q829965) to a different Wikipedia page (i.e. one that is completely devoted to The Beatles discography, such as https://en.wikipedia.org/wiki/The_Beatles_discography).
Note that each Wikimedia/Wikipedia page can only have one sitelink to any one Wikidata item page. You will receive an error message when attempting to add a new sitelink if the page is already connected to another item page (even when trying to link to a redirect page pointing to this particular page). If you receive an error message but believe the item you are editing is the most appropriate one for a sitelink, you may need to merge two items.
Please consult Help:Merge or visit Wikidata:Interwiki conflicts to report a conflict and ask for others to look at the situation.
To connect a redirect page to a Wikidata item, you need to also add a redirect badge (usually intentional sitelink to redirect (Q70894304)) to it. To add a badge, click the icon next to the input field for the page title when adding the sitelink. Previously you can alternatively use local interlanguage links; this is no longer recommended.
A more detailed discussion on how to connect multiple related pages to two or more Wikipedia language editions: Help:Handling sitelinks overlapping multiple items.
Warning: Sometimes you will encounter multiple items with sitelinks to the same Wikimedia page. This is called a true duplicate. See that page for why it happens and how to fix it |
Wiktionary
editWiktionary article pages use a different method for sitelinking articles between language versions, called Extension: Cognate.
Sitelinks to Wikidata are still used in the other namespaces however, such as Special: or Help:.
Why is this?
Wiktionary 'sitelinks' (via cognate) work by matching an exact article name, and not a translation of that name.
A Cognate sitelink for the word 'fire' between the English and German Wiktionary would mean both articles in both versions must have 'fire' in the article space of the URL:
EN: https://en.wiktionary.org/wiki/fire
DE: https://de.wiktionary.org/wiki/fire
With Wikidata sitelinks, moving from the English wikipedia article on 'Fire' to the German Wikipedia, would take you to 'Feuer'
EN WP: https://en.wikipedia.org/wiki/Fire
DE WP: https://de.wikipedia.org/wiki/Feuer
You can read more about the specific tools and rules on Wikidata:Wiktionary/Sitelinks.
Languages
editOne of the primary uses of Sitelinks are providing an easy way to navigate to articles or pages of the same topic but in different languages. The English Wikipedia is the largest and most 'complete' and non-native readers and editors may often end up viewing articles there from their search results, but with the "Languages" tool (powered by Wikidata-Sitelinks), they can navigate to that article in their primary or other preferred language.
Sitelinked articles and pages are not translations
However, there is no guarantee that the linked-page will have the same level of content or completeness as the currently viewed article. Each language version of Wikipedia (or any other Wikimedia project) is an independent instance with its own editing community, policies and responsibility for adding content. This is important to ensure inherent biases of one dominant language and culture are not exported and replicated into other languages and communities. Read more about Wikimedia's Global perspective.
Of course, we encourage readers/editors to expand and edit the article if they see potential to contribute with information they have discovered from another language version or from the Wikidata Item. Learn about article translation of
Old: Sitelinks can be added to Wikimedia sites in more than 300 languages. When adding a sitelink for an item, you will need to input both the language of the Wikimedia site page that the item corresponds to and the title of the page as it appears on the Wikimedia site. You can only add a sitelink for a language and a Wikimedia site if a page on that language version of the Wikimedia site already exists.
Badges
editBadges can be applied to Sitelinks to give a visual clue about the quality or purpose of the the linked article or page. Commonly-used badges are:
- (Silver Ribbon image) Silver Star indicates a Good Article.
- (Gold Ribbon image) Silver Star is a Featured Article.
- (Gold Ribbon image) Good List: Pages that are Lists rather than 'normal' articles.
- Sitelink-to-Redirect: The linked page links again to another page, you are redirected. As Wikidata Items can only be sitelinked to one page per Wikipedia project version, redirects are a workaround to allow multiple links to a single, related concept.
Some Badges (such as Featured and Good Article) are displayed in the language-switcher. To see a full list of Badges, their function and how to apply them, visit the Help: Badges page.
-
On Wikidata: assign Badges by editing the Sitelinks.
Namespaces
editThe Wikidata community agreed in an RFC that most namespaces of Wikimedia projects other than "User" are eligible for storage on Wikidata. This means that in addition to sitelinks for pages like Wikipedia articles and Wikisource texts, sitelinks for categories, templates, and help pages can also be stored in Wikidata. For an example of a Wikidata item referring to a namespace, see item Wikimedia category (Q4167836), which includes sitelinks to w:Wikipedia:Categorization, q:Help:Category, and voy:Wikivoyage:Categories.
Note that when adding a sitelink for a page that is outside of a Wikimedia site's main namespace, you need to keep the namespace in the page title.
Examples:
Wikidata item: Wikimedia category (Q4167836)
Wikiquote page to add as sitelink: <tvar name="1">https://en.wikiquote.org/wiki/Help:Category
Wikimedia site to add under "Language Code": English enwikiquote
Page title to add under "Linked page": Help:Category
Wikidata item: Joan of Arc (Q7226)
Wikiquote page to add as sitelink: https://en.wikiquote.org/wiki/Joan_of_Arc
Wikiquote site to add under "Language Code": English enwikiquote
Page title to add under "Linked page": Joan of Arc
Guidelines for using sitelinks on other Wikimedia sites
editManaging Wikidata sitelinks
editEditors on the English Wikipedia have created a great page with all the necessary information for editors. Much of the information will be relevant to contributors on other Wikimedia projects too.
Suppression of Wikidata links
editAn individual page on a Wikimedia site can completely suppress Wikidata sitelinks by using the {{noexternallanglinks}} magic word. The magic word also supports suppression of sitelinks from only specific languages, for example, "{{noexternallanglinks:es|fr|it}}" would suppress only the Spanish, French, and Italian links. Neither of these uses prevents Wikidata from listing all sitelinks of an item.
Interlanguage links with anchors
editIn the previous system of interlanguage links, an anchor link was used when a Wikimedia site did not have an exact match in another language for a corresponding page, but did have a page that dealt in part with the same subject. However, Wikidata does not support anchors as sitelinks. Previously, it is a practice to retain interlanguage links with anchors locally on the Wikimedia sites (not Wikidata); this is no longer recommended.
If you want to connect a section of a page (also called an anchor) to a Wikidata item, first find an appropriate redirect to that anchor (if none exists, create one), then connect the redirect to the item using Linking to Wikimedia site pages above.
Talk pages
editWhen linking from a Wikidata talk page (or most other pages other than items) to another Wikimedia project, a prefix is used in the wiki markup. For example, if one wished to link to the documentation about JSON format on mediawiki.org, one could write [[mediawikiwiki:Wikibase/DataModel/JSON]]
and the result would be mediawikiwiki:Wikibase/DataModel/JSON
.
A table of available prefixes may be found at Special:Interwiki.
Page renames
editWhen a page is renamed on a client wiki, the page move automatically updates the sitelink at Wikidata, if the renaming user has an active account on Wikidata.
Scenario: A new contributor at English Wikipedia, who has never visited Wikidata, renames an article. The sitelink at Wikidata will continue to point to the page title that has become a redirect.
When page moves aren't reflected on Wikidata, sometimes a second item for the new page title is created, leading to a duplicate on Wikidata. These should be merged.
A bot or Wikibase function could update sitelinks based on the pagemove log at Wikipedia (or other client wikis).
This is currently (November 2021) being done for German Wikipedia (Q48183) and English Wikipedia (Q328) by User:Krdbot.
It's appreciated if users who rename pages on client wikis log in to Wikidata once to create an account.
See also
editFor related Help pages, see:
- Help:Items, which explains what items are and what rules they follow
- Help:Merge, which explains what merges are and how to perform one
- Help:Badges, which explains badges
For additional information and guidance, see:
- Project chat, for discussing all and any aspects of Wikidata
- Wikidata:Glossary, the glossary of terms used in this and other Help pages
- Help:FAQ, frequently asked questions asked and answered by the Wikidata community
- Help:Contents, the Help portal featuring all the documentation available for Wikidata
Welcome! We're very happy to have you here!
| |
Editors
Add statements, qualifiers and sources to enrich the Wikidata knowledge base. Help with migrating language links to support centralized access for all Wikimedia Foundation projects. To learn how to get started, see Help:Items to learn how to add or edit items, or follow an interactive tutorial at Wikidata:Tours. Updating Help pages and improving documentation, for example by adding examples and screenshots, is another great way you can support the Wikidata community. |
Developers/span>
|
Ambassadors
|
Project members
|
Translators
|
Data owners
|
|
Centralising facts across many Wikimedia projectseditCentralising facts for Wikimedia projects on Wikidata will allow people across many different Wikimedia projects in many different languages to work together to collate information which has many benefits:
|
Data quality on WikidataeditWikidata is a young project that is growing quickly. Receiving contributions from users is essential to improving data quality. There are several ways data are added to and improved on Wikidata: IndividualseditIndividual users adding individual facts is the most common way users add data to Wikidata. Wikidata reuses data that has already been added to other Wikimedia projects, however this data is sometimes out of date, incomplete or incorrect. Importing datasetseditData is also added through importing large external datasets. Anyone can request that data is imported from an external source through the Wikidata:Data Import Hub. PartnershipseditThere are several partnerships with external organisations to improve data quality including:
QuerieseditThe Wikidata Query Service is one way that data can be checked for completeness and accuracy, you can request a query at Wikidata:Request a query. Future developmentseditIn future Wikidata will be introducing new features including:
|
Making changes to WikidataeditWhilst Wikidata can be complex when adding a large quantity of data, adding single facts is a relatively simple process with a smaller learning curve than most other Wikimedia projects. The most common tasks on Wikidata are adding statements and adding references. Adding statements and references to Wikidata doesn't require a coding or markup knowledge. If you would like a larger amount of information from an external database added to Wikidata please make a request on the Wikidata:Data Import Hub. StatementseditThe process of adding statements is quite simple and requires no coding skills, an overview can be found at Help:Statements#Adding statements. References on WikidataeditMany facts on Wikidata do not yet have a reference or have a reference of being imported from another Wikimedia project. References are being added all the time both through individual contributions and planned, structured imports from external databases add 1000s or even 10,000 of referenced facts at a time. Adding a reference is a simple process:
For more in-depth instructions for adding references to statements please see Help:Sources. |
Tracking changes to a Wikidata page from other Wikimedia projectseditIt is important for Wikimedia project contributors using data from Wikidata on their pages to know if a change has been made on Wikidata that affects their pages. It is possible to keep track of changes made to Wikidata item pages which are being used to display facts on other Wikimedia projects. On your Wikimedia project (when logged in):
Now when a change is made to a Wikidata item which is being on another Wikimedia project it will be displayed in your watchlist. Currently, the watchlist will not display what change has been made on the Wikidata page or if the statement appears on the article, although these are planned improvements. You can simply use the History tab on Wikidata to find this information like any other Wikimedia project. This is a much clearer and simpler process than transclusion of images from Commons where it is not possible to keep track of changes of an image on Commons from within another Wikimedia project. |
Examples of data reuseeditThere are many ways Wikidata is being used on other Wikimedia projects including:
|
Wikidata fed infoboxes on WikipediaeditIt is possible for infoboxes on Wikipedia to use data directly from Wikidata. Control on the wikieditThe templates that display the data from Wikidata provide additional controls to the wiki so they can customise the data to their needs, this includes:
ExampleseditThere are several examples of Wikidata fed infoboxes on Wikipedia, these include:
GuideseditGuides are available to help set up Wikidata fed infoboxes on Wikipedia |
Maps and graphseditYou can render Wikidata content as maps and graphs in Wikimedia projects, also see Wikidata:Geoshapes.
Lakes with name "Long lake" in Sweden. [ source data ]
|
Mapping work on a subjecteditIt is possible to create lists of missing articles on any subject using Wikidata. This is done by creating a set of items on Wikidata and using a tool to see which articles do and do not exist on which Wikimedia projects:
|
VisualisationseditThere are many tools, both within Wikimedia projects and externally that reuse and combine Wikidata, Wikipedia, Wikimedia Commons and other projects. These tools allow people to explore the content in a new way and can also be used to visualise content to provide new ways to highlight issues and possble improvements.
|
Setting up use of Wikidata data on Wikimedia projectseditWikidata:How to use data on Wikimedia projects provides technical instructions on how to use Wikidata data on another Wikimedia project. You can also find help on the Wikidata:Project chat. |
Data from Wikidata can be directly displayed on Wikimedia projects, with different methods. With the parser function or Lua code, it is possible to display labels, descriptions, values, references, and a lot of other information stored on Wikidata. For an overview of uses on Wikidata on Wikimedia projects see Wikidata:Wikidata in Wikimedia projects.
On this page, you will learn how to use Wikidata data on your wiki. You can also learn more about what is Wikidata, how the information is organized, or browse the glossary.
Can I access Wikidata data from my wiki?
editThe two main client functionalities, parser function and access via Lua, can be enabled together on the wikis of the Wikimedia projects. This is the case for almost all Wikimedia projects now.
To check if these functionalities are activated on a wiki, you can access the page Special:Version
. In the section "Parser function hooks", if "statements" appears in the list, that means that you can use it on this wiki.
The access to Wikidata data is currently restricted to the Wikimedia projects, because of technical limitations. If you have your own instance of MediaWiki, you can't use Wikidata's data using these features. However, you can set up your own Wikibase instance and use data from there in the same way.
Parser function
editThe first way to access data is to use the #statements
parser function. This function will allow you to display the value of any statement included in an item.
Direct access
editOn a page that is connected to a Wikidata item via the interwiki links, you can use the function by adding the label of the property you want in your language or the P-number of the property. The code has to be added in the wikicode.
Examples:
{{#statements:member of political party}}
or{{#statements:P102}}
will return the "member of political party" value.{{#statements:discoverer or inventor}}
or{{#statements:P61}}
will return the "discoverer or inventor" value.- On w:en:Douglas Adams, the code
{{#statements:country of citizenship}}
will display "United Kingdom".
Arbitrary access
editYou can also display data from an item that is not connected via an interwiki link. For this, you use the same function, adding a parameter from=
followed by the Q-id of the item.
Examples:
{{#statements:birth name|from=Q42}}
will display "Douglas Noël Adams"{{#statements:country of citizenship|from=Q42}}
will display "United Kingdom".{{#statements:P1476|from=Q191380}}
will display "Notre-Dame de Paris"{{#statements:author|from=Q191380}}
will display "Victor Hugo"{{#statements:publication date|from=Q191380}}
will display "1831"
Multiple values
editWhen a statements has multiple values, the parser function will show the "best" value(s), which means:
- only show the preferred value(s) if there are any;
- if not, show all the values;
- but never the deprecated ones.
Where there are multiple values, they are shown in a comma-separated list.
Example: {{#statements:occupation|from=Q42}}
displays "playwright, screenwriter, novelist, children's writer, science fiction writer, comedian, writer, musician" (there are other occupations in Douglas Adams (Q42) but only some are preferred).
Formatted values
editFor some properties, the #statements parser function will display the value in a specific format.
- Commons images
The parser function displays a thumbnail preview of the image, resizing it to 200 pixels. It links to the Wikimedia Commons file description page.
{{#statements:image|from=Q42}}
displays
- Geo coordinates
The parser function displays the coordinates in degree-minute-second format.
{{#statements:coordinate location|from=Q243}}
displays 48°51′30″N 2°17′40″E
- Monolingual text
Text values are displayed as they are, with no formatting.
{{#statements:native label|from=Q31}}
displays "Koninkrijk België, Royaume de Belgique, Königreich Belgien
".
- Date
The date value will be formatted in day-month-year format.
{{#statements:date of birth|from=Q42}}
displays 11 March 1952
- Links
The links are clickable.
{{#statements:official website|from=Q243}}
displays https://www.toureiffel.paris, https://www.toureiffel.paris/en, https://www.toureiffel.paris/it
- External IDs
An external ID will provide a direct link to the external website.
{{#statements:IMDb ID|from=Q42}}
displays nm0010930
- Items
Items have their label (in the content language) displayed, without a link.
{{#statements:capital|from=Q142}}
displays Paris
Raw value
editTo display the unlinked value, use #property
.
Sample:
{{#property:IMDb ID|from=Q42}}
displays nm0010930
Modules
editData can also be accessed with Lua modules, which are much more flexible. Modules that access data from Wikidata should be organized as instance of Wikimedia module using Wikidata (Q59259626). For instance, Module:Wikidata (Q12069631) is available on many wikis, see w:Module:Wikidata#Usage for usage instruction. If your wiki does not contain a module you can copy it from another wiki and add documentation.
For a full technical reference of Lua functions for accessing Wikidata, see mw:Extension:Wikibase Client/Lua.
Templates
editSome templates use modules to access Wikidata data. They are as simple to use as regular templates. Moreover, using Wikidata, some parameters become unnecessary. For instance, some infoboxes are able to retrieve data from Wikidata, so you just have to insert the template and all the data will magically appear (if the needed information is present on the Wikidata item, of course). For templates using Wikidata see Category:Templates using data from Wikidata (Q11985372).
If you want to create a template on your wiki, check your documentation page about Module:Wikidata and already existing templates.
Lists
editRegularly updated lists
editDaily updated lists based on SPARQL queries can be configured using Template:Wikidata list (Q19860885). Content is replaced daily.
There are essentially two uses:
- Work lists: lists with topics to be covered in project namespace. Results can be limited to topics that don't exist.
- Reference list: lists for a specific topic in article namespace.
This is currently the most efficient way of doing lists.
Dynamic lists
editContent is displayed from various items based on a selection done in a Lua module.
Manual lists
editA series of items are selected and their properties displayed in an article. Content from Wikidata can be completed with locally edited text.
Examples of use cases
editMagic infobox
editA call of the general cheese infobox template fr:Modèle:Infobox Fromage without any parameters, on an article about a type of cheese, for example fr:Reblochon, produces an infobox with details about that type of cheese, using data from the Wikidata item linked to the article.
Commons
editCommons creator template uses Wikidata with arbitrary access to provide information about the creators of the works.
Graph
editAuthority model
editWikisource
editHow to find help ?
editYou will find contributors on the Wikidata project chat which exists in different languages. Moreover, some wikis have projects dedicated to Wikidata : see Project:WikiProject Wikidata (Q20855878).
See also
edit- Module:Databox, a ready-made set of modules for building infoboxes
- Wikidata:Infobox Tutorial
- Help:Statements