Page MenuHomePhabricator

Let's build a WordPress plugin to embed Wikimedia content!
Closed, ResolvedPublic

Description

Wikimedia sites are made by one of the largest online communities of knowledge gathers. WordPress is the largest single content distribution software outside of proprietary social networks. 26% of all websites on the internet use WordPress. 0 1

Let's make it easier for folks using WordPress to embed Wikimedia content in their sites.

This session proposes putting together a minimal viable product that would allow WordPress users to copy and paste a Wikimedia URL into the editor in a WordPress installation to embed an in-line preview. I'd like to discuss the design and implementation of such a feature (what do we need to include for attribution, how much content do we display inline?) and the technical underpinnings of APIs and implementation details.

Mockups and prior proposal on Grants IdeaLab:
https://meta.wikimedia.org/wiki/Grants:IdeaLab/Make_it_easy_to_embed_Wikimedia_content

Technical documentation on how to extend WordPress to include new content types:
https://codex.wordpress.org/Embeds#How_Can_I_Add_or_Change_Support_For_Websites.3F

Relevant MediaWiki APIs:
https://www.mediawiki.org/wiki/REST_API
https://www.mediawiki.org/wiki/Page_Previews/API_Specification
https://www.mediawiki.org/wiki/Extension:TextExtracts
https://www.mediawiki.org/wiki/Extension:PageImages

Prior works:
https://github.com/hay/photocommons
https://wordpress.org/plugins/wiki-embed/
https://github.com/Commonists/CommonsOnCMS
https://wordpress.org/plugins/contexto/

Semi-related:
https://wordpress.org/plugins/pixabay-images/
https://wordpress.org/plugins/photo-dropper/
https://wordpress.org/plugins/simison-wikimedia-commons-potd-wp-login/

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 21 2018, 3:35 PM
CKoerner_WMF updated the task description. (Show Details)Feb 21 2018, 3:41 PM

An alternative to defining the Embed manually in a plugin would be for MediaWiki to support the oEmbed protocol. Maybe that's part of T56829. Then, to get it working in WordPress, it'd just be a matter of lobbying them to include Wikimedia sites (and they seem to include FunnyOrDie.com so surely would support us!).

Rfarrand triaged this task as Normal priority.Mar 6 2018, 5:24 PM
Rfarrand moved this task from Backlog to Project on the Wikimedia-Hackathon-2018 board.
Tgr added a subscriber: Tgr.Apr 8 2018, 6:27 PM

Maybe relevant: Wikimedia Commons on WordPress − a WordPress plugin to embed Commons pictures (for which I tutored a student project some (gosh) 6 years ago)

Maybe relevant: Wikimedia Commons on WordPress − a WordPress plugin to embed Commons pictures

https://www.mediawiki.org/wiki/PhotoCommons also exist(ed) ("PhotoCommons is a plug-in for WordPress allowing easy searching, inserting and maintaining of files from Wikimedia Commons into your blog.").
I contacted its authors (krinkle; huskyr) in 2013 about the project status but received no reply, and I'm not sure its code is still available anywhere as SVN is gone.

Husky added a subscriber: Husky.May 18 2018, 10:53 AM

@Aklapper the code is actually still on my Github repo:

https://github.com/hay/photocommons

But i'll attend the session anyway. Looks interesting!

This comment was removed by jgleeson.
CKoerner_WMF updated the task description. (Show Details)May 18 2018, 2:04 PM

This session proposes putting together a minimal viable product that would allow WordPress users to copy and paste a Wikimedia URL into the editor in a WordPress installation to embed an in-line preview.

It might help to explicitly write down how it would differ from https://wordpress.org/plugins/wiki-embed/

Hey, I was looking for Wordpress Plugins that use Wikidata and found https://wordpress.org/plugins/contexto/ .

Husky added a comment.May 18 2018, 2:25 PM

@Aklapper the code is actually still on my Github repo:

https://github.com/hay/photocommons

But i'll attend the session anyway. Looks interesting!

Actually the code over here is more recent than the one on my Github repo:
https://phabricator.wikimedia.org/diffusion/SVN/browse/trunk/tools/wp-photocommons/

Husky added a subscriber: Krinkle.May 18 2018, 3:12 PM

Okay, so @Krinkle helped me with getting the old SVN dump into my Github repo, and i hacked the code really ugly and got it working again on the most recent version of WordPress.

If you clone this into a directory called 'wp-photocommons' in the plugins directory of your WordPress repo you should get an extra button in the new post interface to add a Commons image.

MediaWiki API that returns JSON for media files on Wikimedia Commons:
https://www.mediawiki.org/wiki/Extension:CommonsMetadata

Example: api.php?action=query&prop=imageinfo&iiprop=extmetadata

  • LicenseShortName / LicenseUrl
  • Artist

Currently used by MediaViewer (and maybe Mobile apps?) to decide which license-related icons to display (public-domain, CC BY, CC BY-SA), and which short attribution text.

There is also a JavaScript gadget on Commons called StockPhoto, which performs logic similar to what CommonsMetadata does in PHP, and uses it to provide a simple attribution/license credit line for embeds on other websites (using HTML or BB code).
See: https://commons.wikimedia.org/wiki/Help:Gadget-Stockphoto.
Example: https://commons.wikimedia.org/wiki/File:Close-up_of_Mirall_at_night_in_2016.jpg.

Out of curiosity, was there anything salvageable from https://github.com/Commonists/CommonsOnCMS ? :)

@CKoerner_WMF: Did this take place? What's the status / results of this task?

CKoerner_WMF closed this task as Resolved.Aug 28 2018, 6:59 PM
CKoerner_WMF claimed this task.

I had a draft sitting here in Phabricator but never published.

Some notes from the session:

  • We had a discussion on what is possible and I learned that there are more API's (as @Krinkle points out) that would make this possible with some work.
  • Learned of more prior works as folks mentioned in the task here

Next steps

  • Investigate developing a plugin that would add oEmbed support for Commons
  • Investigate developing a plugin that would allow you to search Commons for reuse
  • Other related ideas?

I have no update to make beyond that as I haven't had the time to work further on this. Marking resolved for now, happy to discuss if folks are interested.

jgleeson removed a subscriber: jgleeson.Aug 28 2018, 7:03 PM

I've had a crack at a draft of a Wikimedia URL embedding plugin: https://wordpress.org/plugins/embed-wikimedia/