Extension:WikidataPageBanner

The WikidataPageBanner extension adds pagewide banners on allowed pages of a wiki. Pagewide banners are extensively used on Wikivoyage projects and this extension is inspired majorly from pagebanner

Usage
The extension automatically adds a banner image on pages of specified namespaces provided $wgEnableDefaultBanner is set to true. To use a custom banner image, use   with a set of parameters explained below. If the wiki is connected to wikidata, it can also fetch banners from there

Parameters to the function
The following parameters are supported to the   parser function: The x and y values range from -1 to 1. For example: Any values in between -1 and 1 will place the focus in between those positions.
 * pgname - Adds a custom title to the banner.
 * To add custom icons, add the parameter icons=star,unesco to  . Then define a background-image on .oo-ui-icon-star and oo-ui-icon-unesco, in Mediawiki:Common.css to use as the icon. Do this for any no. of icons to add to the page.
 * caption - Use caption=description to add a caption to the banner image.
 * tooltip - Use tooltip=image-caption to show image description on hovering over image.
 * toc - Use toc=yes to enable a Table Of Contents within banner.
 * bottomtoc - Use bottomtoc=yes to push Table Of Contents below banner.
 * origin - Use origin=, where x and y in angular brackets represent the x and y positions of the focus of the banner. This feature is particularly useful if any dimensions of the banner exceed that of the viewport, especially on the screen.
 * -1,-1 specifies extreme top left as focus.
 * 1,1 specifies extreme bottom right as focus.
 * -1,1 specifies extreme bottom left as focus.
 * 1,-1 specifies extreme top right as focus.

Required Settings
$wgWPBImage is used to set the default banner image to be used. Add image name without prefixing 'File:' namespace. Note that if the wiki does not need default banners, do not edit this field. $wgWPBBannerProperty (Essential if Wikidata is enabled) - Banner property on wikidata which holds commons media file To see default banners on pages even without the use of, set $wgWPBEnableDefaultBanner to true

Optional Settings
$wgWPBBannerNamespaces array of namespaces on which to dispaly the banner. Default is Main namespace $wgWPBStandardSizes is an array of standard predefined screen widths in increasing order of size

Examples
A few use examples with explanation: Will add a banner using image Grand_canyon.jpg as source locally or from wikimedia commons. Will add a banner using image Grand_canyon.jpg as source locally or from wikimedia commons. Additionally will add icons with class names oo-ui-icon-star, oo-ui-icon-unesco. Set background-image property on theses classes in Mediawiki:Common.css to your desired icon. Will add a banner using image Grand_canyon.jpg as source locally or from wikimedia commons. Additionally adds a toc inside banner. Sets the name displayed on banner as Some page. Will add a banner trying to fetch banner image from wikidata property specified above if exists. If it does not exist, tries to add a default banner. Sets the name displayed on banner as Some page. Also sets the banner focus somewhere towards bottom right.

Styling
The extension has ample scope of styling the banner from Mediawiki:Common.css For example, putting the codes given below in Mediawiki:Common.css would result as explained below: This would set the toc to appear just below the banner in case its long Would set the font size of Banner Name as 1em.