Extension:WikidataPageBanner

The WikidataPageBanner extension adds pagewide banners on every page of specified namespaces of the wiki. Pagewide banners are extensively used on Wikivoyage projects. This extension is majorly inspired by Wikivoyage's Template:pagebanner

Usage
The extension automatically adds a banner image on pages of specified namespaces. 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:
 * pgname - Adds a custom title to the banner.
 * To add custom icons, add the parameter icon-icon_name= to  . Then define a background-image on .oo-ui-icon-icon_name, in Mediawiki:Common.css to use as the icon. Do this for any no. of icons to add to the page.
 * 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 - Defines a focal area for the image defining a separated x and y coordinate defining a vector from the center of the image that is a recommended focal area for the banner e.g. origin=1,1 is the top left corner and origin=-1,1 is the bottom left corner.. It is used to crop the banner accurately on smaller screens. This graphic provides further information.

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.

Example usage for banner from wikidata
Make sure $wgWPBBannerProperty is set to correct wikidata banner property. Just use 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 only if $wgWPBEnableDefaultBanner is set to true(default value is false).

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.