Page MenuHomePhabricator

Provide Open Graph tags for Wikidata
Closed, ResolvedPublic

Description

For example: when shared on Facebook, http://www.wikidata.org/wiki/Q6294 would provide the image http://commons.wikimedia.org/wiki/File:Hillary_Clinton_official_Secretary_of_State_portrait_crop.jpg to Facebook as a preview due to it being linked from the image property in Wikidata.

https://developers.facebook.com/docs/sharing/webmasters#markup

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:10 AM
bzimport set Reference to bz49859.
bzimport added a subscriber: Unknown Object (MLST).

More data on Google's rich snippets and preparing structured data for search results http://support.google.com/webmasters/bin/answer.py?hl=en&answer=99170

Documation for Twitter Cards https://dev.twitter.com/docs/cards Photo, Large Image, or Summary card type might be appropriate for wikidata links

How does this differ from bug 31338?

Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Lydia_Pintscher removed a subscriber: Unknown Object (MLST).
Sjoerddebruin renamed this task from Provide Opengraph tags for Wikidata links when shared to parse commons images and summary when available to Provide Open Graph tags for Wikidata.Oct 7 2016, 11:21 AM
Sjoerddebruin updated the task description. (Show Details)

@Sjoerddebruin shared some more links with me:

The image does have the biggest impact. Since T112865: [Story] Add Wikibase support for PageImages we do support PageImages and can easily add the relevant <meta property="og:image" content="https://…" /> line.

FYI. In the past several editors in communities and some developers have raised objections to most of these kinds of additional tags, because it's non-standard additional page-weight for the benefit of a commercial company.

+ WP:NOTFACEBOOK-nonsense and all that... just wanted to make sure that is taken into account when launching this.

This is a very valid concern. Thanks a lot for the reminder, @TheDJ. I was hoping that Open Graph is what it claims to be: open, and not exclusive to Facebook. We should validate this first (relevant Stack Overflow: http://stackoverflow.com/questions/10397510/do-services-other-than-facebook-use-open-graph).

Main main pro argument still is: Wikidata items are perfect to be represented as Twitter cards and such.

Additionally, I suggest to start with the image, and only with the image. Title and description are already there, and Facebook should be able to fetch them without us providing redundant meta tag garbage (og:title would be identical to <title>, and og:description to <meta name="description">, see T88475: [Story] Add meta description in the header for Wikibase pages).

Discussed with @Lydia_Pintscher today. We tried what Facebook does right now, and it does find title and description since T88475. The only thing missing is the image. We decided we will only add og:image.

To be sure I actually tested this and found that Facebook is happy with this minimum:

<title></title>
<meta name="description" content="…">
<meta property="og:image" content="…">

I did the same test with Twitter and found that Twitter requires this minimal subset:

<meta name="twitter:card" content="summary">
<meta property="og:title" content="…">
<meta property="og:description" content="…">
<meta property="og:image" content="…">

Note that this is different from what is said on https://dev.twitter.com/cards/types/summary:

  • The docs give the impression twitter:site is required, but it's not.
  • Twitter indeed does recognize Open Graph.

But these four tags are required. The moment you remove one, Twitter will not render a nice card any more. You can not replace og:title with the classic <title>. You can not replace og:description with the classic meta description. This is a show stopper for us, because we do not like to have redundant titles and descriptions.

Yeah then let's do only open graph image for now.

Regarding twitter support, It seems they changed it again and now it doesn't support OpenGraph anymore and it has its own tags which makes me super unhappy. Let's go with simple facebook for now.

Change 333891 had a related patch set uploaded (by Ladsgroup):
Allow OpenGraph RFDa meta tags

https://gerrit.wikimedia.org/r/333891

Change 333944 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
Add tests for OutputPage::addMeta and set{Index|Follow}Policy

https://gerrit.wikimedia.org/r/333944

Change 333944 merged by jenkins-bot:
Add tests for OutputPage::addMeta and set{Index|Follow}Policy

https://gerrit.wikimedia.org/r/333944

Change 334789 had a related patch set uploaded (by Ladsgroup):
Add PageImage OpenGraph tag

https://gerrit.wikimedia.org/r/334789

Change 333891 merged by jenkins-bot:
Allow OpenGraph RFDa meta tags

https://gerrit.wikimedia.org/r/333891

Change 335216 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
Add basic test for PageImages::onBeforePageDisplay

https://gerrit.wikimedia.org/r/335216

Change 334789 merged by jenkins-bot:
Add PageImage OpenGraph tag

https://gerrit.wikimedia.org/r/334789

Change 335216 merged by jenkins-bot:
Add basic test for PageImages::onBeforePageDisplay

https://gerrit.wikimedia.org/r/335216

thiemowmde assigned this task to Ladsgroup.
thiemowmde removed a project: Patch-For-Review.
thiemowmde moved this task from consider for next sprint to in progress on the Wikidata board.

We are going to add og:description and og;title (per the discussion in T157145: Twitter cards don't work for any projects besides Wikidata)

Change 336766 had a related patch set uploaded (by Ladsgroup):
Add og:title and og:description

https://gerrit.wikimedia.org/r/336766

Change 338360 had a related patch set uploaded (by Thiemo Mättig (WMDE)):
Remove all optional SEO meta tags from diff pages

https://gerrit.wikimedia.org/r/338360

Change 336766 merged by jenkins-bot:
Add og:title and og:description

https://gerrit.wikimedia.org/r/336766

Change 338360 merged by jenkins-bot:
Remove all optional SEO meta tags from diff pages

https://gerrit.wikimedia.org/r/338360