Page MenuHomePhabricator

[Spike, 8hrs] Where should Schema property 'sameAs' live?
Closed, ResolvedPublic0 Estimate Story Points


In T198946 we identified a change we'd like to make to add a tag to the top of pages. While the change is simple we're not clear where this code should live.

The spike should involve talking to various people (e.g. component developers) and answer the following questions:

  • Is there any existing extension that does this already?
  • Should this live in the Google Rich Cards extension ?
  • Should it be a gadget?
  • Should it live in a Wikibase extension?
    • Which one?
  • Should it live in MobileFrontend?
  • Should it live in core?
  • Should it live in its own extension?
    • If so does it need security review?


  • Evaluate all the options and cast a judgement on the best
  • Send a wikitech-l email (including wikimedia DE) for discussion
  • Draw a conclusion

Sign off steps

  • Make sure T198946 is no longer marked as stalled.

Event Timeline

Jdlrobson triaged this task as High priority.Sep 11 2018, 4:26 PM
Jdlrobson created this task.
Niedzielski changed the edit policy from "Custom Policy" to "All Users".Sep 12 2018, 3:22 PM
Jdlrobson updated the task description. (Show Details)Sep 12 2018, 4:18 PM
Jdlrobson updated the task description. (Show Details)Sep 12 2018, 4:23 PM
ovasileva renamed this task from [Spike, ?hrs] Where should Schema property 'sameAs' live? to [Spike, 8hrs] Where should Schema property 'sameAs' live?.Sep 12 2018, 4:24 PM
ovasileva moved this task from Triaged but Future to Upcoming on the Readers-Web-Backlog board.
Jdlrobson set the point value for this task to 0.EditedSep 12 2018, 4:39 PM

(to mark we've (jan,stephen,piotr,nick,myself) talked about this in today's estimation meeting)

nray added a comment.Sep 26 2018, 10:51 PM

Sent an email today to Lydia Pintscher (product manager for Wikidata) asking if her team could give us some feedback on whether one of the existing wikibase extensions would be a suitable place for this code to live.

nray added a comment.EditedSep 27 2018, 11:39 PM

Is there any existing extension that does this already?

Google Rich Cards is the closest one I can find.

Should this live in the Google Rich Cards extension?

Pros: Already setup as an extension that outputs json-ld. Has well-defined responsibilities.
Cons: Looks like it does not currently support the 'sameAs' property. Currently adds script to head which would block. May include more attributes then desired. Not deployed to any of our wikis yet so would need security review and patches to operations/mediawiki-config.

Should it be a gadget?

Pros: Fast to setup
Cons: Adds json-ld script dynamically (through javascript) which may cause readability issues in search engines other than Google. Would need to enable on a per wiki basis. Could this be toggled on/off by users and affect search engine efficacy?

Should it live in a Wikibase extension? Which one?

Lydia from Wikidata team has said it might be able to go into the Wikibase Client extension. Seeking an opinion from @Addshore on how viable this would be.

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.
Cons: Is this making the Wikibase Client do too much?

Should it live in MobileFrontend?

Assuming we want the json-ld to be in mobile and desktop sites, I don't see this as a viable option.

Should it live in core?

Pros: Nothing immediate comes to mind
Cons: Probably asking core to do too much / not a responsibility of core

Should it live in its own extension? If so does it need security review?

Pros: Could be an extension with well-defined and singular responsibilities outputting json-ld with the exact attributes we want.
Cons: Would need to "start from scratch" making an extension and might be time-intensive. Seeking clarification from security team on whether this would need a security review.

nray added a comment.Sep 27 2018, 11:51 PM

Sent an email to the security team today clarifying if a security review would be needed for a new extension housing this code.

I don't know much about the "Google Rich Cards" extension, but it sounds like it could fit well. When that extension detects that it is loaded in Wikibase it could add the extra sameAs stuff that we want linking to wikidata.
It would also make just as much sense to put it in WikibaseClient and have a config to enable / disable it for different peoples situations.
I don't think any of the other options really make sense, other than perhaps being its own extension.

nray added a comment.Sep 28 2018, 3:50 PM

Heard back from Brian Wolf (Security Engineer) on whether creating a new extension would require a security review. He had this to say:

Yes, security review is needed for all new extensions. This sounds pretty trivial though. The review would probably take 30 seconds. Just ping us when code is written and we'll be able to review it pretty much on the spot.

I think that creating a new extension just to inject one extra tag is a bit overkill. Adding it to MW core is also not the best solution as it throws too many responsibilities to the Core package.
Adding to the Google Rich Cards can be an option, but then most probably we should rename the extension, as it will serve a bit more than Rich cards support.

IMHO the most reasonable solution is to add sameAs support to the WikibaseClient, just hide it behind the config variable.

nray added a comment.EditedOct 1 2018, 3:26 PM

Thanks for the feedback @Addshore and @pmiazga . Seems like putting it in the Wikibase Client would be both practical and a good fit for this so I'm recommending to try that approach first.

nray added a comment.Oct 1 2018, 3:29 PM

Moving this to Ready for Signoff (and skipping QA) as there was no code written for this card.

nray removed nray as the assignee of this task.Oct 1 2018, 3:29 PM
nray added a subscriber: nray.
Jdlrobson claimed this task.Oct 1 2018, 3:30 PM
Jdlrobson closed this task as Resolved.Oct 1 2018, 10:56 PM

Thanks @nray I've updated T198946 with your feedback/recommendation.