Outcome from 2018 SEO project with Go Fish Digital:
Schema.org is an open standard which allows website owners to add structured annotations to their pages. Aside from being generally useful, Schema properties are used by search engine crawlers to understand pages. Adding Schema properties to pages generally boosts their ranking in search results. Wikimedia sites have generally been lucky that the crawlers understand them, and explicitly adding Schema annotations improves the chances that these crawlers will continue to understand our sites.
Go Fish Digital recommended that we add the Schema property sameAs to our pages, pointing to Wikidata. This is a very important property, and whilst other properties are useful, they think sameAs will have the biggest impact, so let's start there.
For example, for the page Yegor_Khokhlov on the English Wikipedia, the Schema annotation in JSON-LD would look something like this:
<script type="application/ld+json">
{
"@context": "http://schema.org",
"name": "Yegor Khokhlov",
"url": "https://en.wikipedia.org/wiki/Yegor_Khokhlov",
"sameAs": [
"https://www.wikidata.org/wiki/Q8051149"
]
}
</script>Instead of adding a JavaScript block, we will put the tag inside the HTML.
Acceptance criteria
- The meta tags are configurable by a config flag
- The meta tags are disabled by default
- When enabled, the meta tags appear in the HTML
- If a page has no corresponding Wikidata entry, there is no metadata tag.
- sameAs tag present without JavaScript.
Developer notes
Per T204070 we think this would be best inside the WikibaseClient extension
Pros: The code relies on wikibase item data set by wikibase client so it might be more convenient to put it in the same codebase with a feature flag rather than creating a new extension that depends on Wikibase Client. Wikibase extension has already been setup and is used in many wikis.