Wikimedia-AU / MediaWiki-skin

This repo has moved to Gerrit.
https://gerrit.wikimedia.org/r/q/project:mediawiki/skins/WMAU
2 stars 1 forks source link

Add per-page hero image that incorporates the page title #3

Closed samwilson closed 3 years ago

samwilson commented 3 years ago

@jdlrobson: What's the best way to use a page property defined by another extension? I want to use the image defined by the WikiSEO extension as a banner that is displayed above the page <h1>. So, a page could have something like this (in a template):

{{#seo:
 | description = {{{description|An item from {{SITENAME}}.}}}
 | image = {{filepath:{{{image}}}|800}}
 | keywords = {{{keywords|}}}
 | author = {{{author|}}}
}}

(This sets the og:image meta tags and others.)

Those items are saved as page properties. It'd be nice to be able to retrieve them in the skin. Is this something that the WikiSEO extension should do? Or should the skin pull them in?

The other way I'm thinking of doing this is by adding a new parser function (in the skin) so that it can just set the banner image name and add everything it needs. That feels like reinventing the wheel though.

I looked at using the WikidataPageBanner extension, but it adds the banner to the subtitle, and we want it to be above the page title and outside of the main constrained-width area. Perhaps I could add a feature that that extension though, to make it easier to put elsewhere.

samwilson commented 3 years ago

Disregard this, it looks like the WikidataPageBanner extension just hadn't updated it's docs; it looks like it'll do everything required.

samwilson commented 3 years ago

There's some iterating to do still (e.g. we might want to define two different images for pages, one skinny banner and one with better dimensions for sharing) but this is basically done now.

Demo: https://wikimedia.org.au/wiki/October_wikiD_Workshop_held_in_Melbourne?useskin=wmau