Page MenuHomePhabricator

GSoC proposal for Wikivoyage PageBanner extension
Closed, DuplicatePublic


This is a GSoC proposal to move the wikivoyage pagebanner template functionality to an extension and make it mobile friendly

Profile Information

Name: Sumit Asthana
irc nick: codezee
Mediawiki User:Sumit
Location: India
Time Zone: UTC+5:30
Typical working hours: 6PM to 2AM before 26th April, 12PM to 1AM after 26th April(Indian Standard Time)


English Wikivoyage uses the concept of pagebanners and horizontal table of contents on each of its page, to alter the way the page is presented and for visual appeal.

However the current pagebanners are rendered using the pagebanner template which displays a banner image on top and strips the original TOC and replaces it with a horizontal TOC. The desktop version is visually appealing, but it does not render well on mobile as shown below:

desktop.png (660×1 px, 547 KB)

mobile.png (369×578 px, 121 KB)

Clearly, in the mobile view, the banner is being obstructed by the edit box, and size is inappropriate In order to create a generic view, which would be consistent on both mobile and desktop as well as customizable, the proposal is to move the above functionality to a PageBanner extension, which would then be responsible for the rendering of pagebanners and a horizontal TOC on each page of wikivoyage

Also, the current pagebanner only shows level 1 headings. For long articles, sub-categories are required. A discussion on english wikivoyage's pagebanner expedition's discussion page captures this.

Possible mentors

  1. Jon Robson
  2. Nicolas Raoul


In order to create a generic view, which would be consistent on both mobile and desktop as well as customizable, the proposal is to move the above functionality to a PageBanner extension, which would then be responsible for the rendering of pagebanners and horizontal TOC on each page of english wikivoyage


Step 1: Create a basic banner along the lines of the template. This involves:

  • Creating a parser function as '#pagebanner' which when supplied no argument, adds a banner image from wikidata property P:948(default)

Current pagebanner template invocation is like:

{{pagebanner|Ladakh_banner.jpg|caption=Mountains in eastern Ladakh}}

Parser function will have a similar invocation like:

{{#pagebanner: Ladakh_banner.jpg|caption=Mountains in eastern Ladakh}}

This is being done with the aim to create minimum change from end user's perspective

  • The wikidata image will be fetched using lua scripting supported by mediawiki
  • The parser function will support additional parameters to mimic the current pagebanner template in terms of its use, so that end-users perceive minimum change(taken from the template's doc page):
    • caption text: Recommended. Enter caption=description to display a description of the picture when a mouse pointer is placed over the banner image.
    • page name: Optional. Enter pgname=name to display in the banner. Only enter a name if you want it to be different than the formal name of the page.
    • disambiguation: Optional. Displays a disambiguation icon in the banner (a question mark) and the disambiguation hatnote after the banner. Enter disambig=yes if the name of the disambiguation page is page name (disambiguation). Enter disambig=disambiguation page name if the disambiguation page name is different from the current page name.
    • star: Optional. Enter star=yes if the guide is a Star article. This displays the Star article symbol in the top right corner.
    • DotM: Optional. Enter dotm=yes if the guide is a previous Destination of the month. This displays the DotM symbol in the top right corner.
    • OtBP: Optional. Enter otbp=yes if the guide has been featured on Off the beaten path This displays the OtBP symbol in the top right corner.
    • Ftt: Optional. Enter ftt=yes if the guide has been a Featured travel topic. This displays the Ftt symbol in the top right corner.
    • unesco: Optional. Enter unesco=yes if the guide is or describes a site on the Unesco World Heritage list. Only the lowest level guides in the hierarchy should be tagged (ie, Sydney/City Centre for the Opera House, not Sydney). This displays the World Heritage symbol in the top right corner and adds a category.
    • TOC box: Optional. Enter box=black for the TOC to appear in a translucent black box with white type. Enter box=white for the TOC to appear in a translucent white box with black type. Enter nothing for the default solid grey box with black type.
    • notoc: Optional. Enter notoc=true to stop the TOC being included in the banner and for the entire TOC to be shown within the article instead. Mainly to be used on articles with lots of sections.
    • index: Optional. Enter index=yes for banners on title/index pages or pages in other main namespace article categories which do not always get banners.
    • fop: Optional. Enter fop=yes for freedom-of-panorama banners which are not allowed on Commons, to remove them from applicable maintenance categories
    • (from banner expedition discussion) Some thoughts regarding the sub-headings of TOC can be taken

Add a link to the page of banner property on wikidata, in case of a need to edit the banner
Step 2: After the code for the banner generated, its important to detect the screen size of the user and resize the banner appropriately. This step is essential for mobile users, who are one of the important targets of this extension. The styling for the banner will reside inside the extension, which will determine its appearance on both mobile and desktop from a single location.
Note that this can be overridden in wiki's Common.css and Mobile.css
This talk on Mobile frontend regarding banner styling will be the starting point.
Also, implement the sub-categories feature after discussion with the wikivoyage community. A parameter switch will be provided to display the sub-categories or not

This involves putting the toc-level-1 divs in horizontal TOC and putting toc-level-2,3,4 headings as drop-downs using css and javascript by identifying them and using dom manipulation to create their own hierarchy. An example requiring this feature is this page which has a lot of sub-headings so the toc in banner is disabled. However since this is a new feature, rather including it in the extension compulsorily, it'll be as an experiment in the beginning

Step 3: Create a simple popup edit box, which will be invoked by an edit button on the banner, and will allow for choosing a banner image from here, and which will change the banner in wikitext.
Since the wikivoyage banners category page has a large number of banners grouped in various categories, the UI will fetch the hierarchy of categories using mediawiki api, display them as a side-content, and fetch their banners in the main view.
The edit box could also provide a way of choosing background color for the TOC(subject to views from the community).
A switch will be provided to enable/disable the feature of choosing a banner image

Step 4: Test the extension on the labs server using both wikidata value and local value of pagebanner and also the edit feature.
Step 5: Document the extension extensively for use by the wikivoyage community.


A rough design of the banner with the image chooser UI is given below:

banner_new.png (690×1 px, 51 KB)


Phase I: Get a mediawiki test lab instance and create and deploy the basic version of the extension which simply displays a banner image given to it through the parser hook
Phase II: Create the lua script to fetch default banner value from wikidata
Phase III: Add banner customization options to the extension as well as styles
Phase IV: Make the banner responsive so that it renders well on Mobile View as well
Phase V: Create and integrate the image chooser UI into the banner
Phase VI: Deploy and test the final extension on mediawiki-test labs and document the extension


  • The pagebanner template functionality will be provided by the extension
  • Mobile frontend will have a resized banner according to the size of the browser as well as positioned appropriately
  • Horizontal TOC of the banner will support sub-categories through drop-down links.
  • Documentation for the pagebanner extenstion.


Before April 27Request a mediawiki labs instance and a gerrit repository for the extension. Set up the skeleton of the extension such as i18n files and the basic setup
April 27-May25Community bonding period,Interact with the wikivoyage community and refine the banner issues
May 25Official GSoC coding begins
May 25-June 9This will involve creating extension and the parser function responsible for creating the banner functionality(Step 1)
June 10-June 15Create the script which will fetch the default banner from wikidata
June 16-June 25Add the options to the parser function mentioned in step 3 to customize pagebanner
June 26-July 18Add styling and scripts to make the extension compatible with Mobile frontend. Also involves making a horizontal-toc render on mobile
July 5-July 25Create the UI to choose the pagebanner image(implement and integrate with banner)
July 19-August 10Wrap up the extension and all its parts to be ready for deployment
August 11-August24Test and remove any remaining bugs after deploying on mediawiki-test labs and provide documentation.


I will follow the mentioned ways to go about the project:

  • The project report will be updated on the sub-namespace of my user page as well as on phabricator
  • Through #wikimedia-dev, #wikimedia-mobile and Wikidata irc channels as I've been doing for solving bugs till now.
  • through wikitech-I mailing list in case of getting an opinion.
  • For seeking views from the wikivoyage community, by starting a discussion on the Traveller's pub.

Source Code

Source code will be pushed on a gerrit repository after acquiring one.
The request for a new gerrit repository has been initiated. The tracking bug for the same is at T93127

About Me

  • I'm a second year undergraduate student of computer science at IIT Patna
  • My major interest is in web languages(php,html,javascript,css) where I have done maximum work

I like to design web pages as well as do backend coding, and I'm inspired by the awesome design works out there on the web created by developers.
I had been contributing to wikimedia-mobile and was learning about the changes needed to be made for mobile users, and also looking for making some significant contributions, as being a part of something big is great!

I came across the wikivoyage banners which weren't perfect on mobile. This prompted me to follow this up. First I talked to my mentor who helped me push this project forward. Since the idea was shaping up for an extension, I looked through other issues and requirements for the banner on the banner's discussion page and on the traveller's pub and also here and also started a discussion myself here for some inputs, which helped me refine the banner's requirements in addition to the discussion and inputs from people on the phabricator page. Also these pagebanners are an important component and attraction of wikivoyage, improving which I believe could greatly benefit to wikivoyage.

Therefore I have decided to take it up. I'm looking forward to enhancing this feature to make it more awesome and also sure of delivering it.

How did you hear about the program

I heard about the program from my seniors and my friend who had been gsoc students.

Will you have any other time commitments, such as school work, another job, planned vacation, etc., during the duration of the program?

By 25th April,our summer vacation of college will start and ends by late of July; I can give my full time commitment to this project,. I assure dedication of at least 40 hours per week to the work and that I do not have any other obligations from early May till mid August.

We advise all candidates eligible to Google Summer of Code and FOSS Outreach Program for Women to apply for both programs. Are you planning to apply to both programs and, if so, with what organization(s)?

Only GSoC, for mediawiki

Past Experience

My open source experience began with the use of linux. However my open source contributions began with mediawiki since its based on the languages I know.In the past months I have submitted quite a few patches in core as well as in Mobile Frontend where the project aims to solve the problem and got them merged. Some are:
In core

  • Database bug to correctly handle the use of 'IN' in makeList function
  • Improving the captcha view for non-javascript users on login/signup form, T85192 and T87190
  • Fix to remove deprecated tables from category page and add responsive layout so that they render well on mobile T85496

In Mobile Frontend

All Gerrit contributions(past and ongoing)
Other Projects

Event Timeline

Sumit raised the priority of this task from to Needs Triage.
Sumit updated the task description. (Show Details)
Sumit added subscribers: Andyrom75, Danapit, Glaisher and 15 others.
Niharika triaged this task as Medium priority.
Niharika set Security to None.

please add your comments and feedbacks on the specifications, and help improve this :)

@Sumit, thank you for this project proposal. Have you got a chance to complete one or more microtasks? I am not the right person to evaluate your proposal, but I can tell that you have clearly put a good amount of work here, and complementing this with completed microtasks would make you a stronger candidate.

If anyone takes on the microtask associated with that and completes it I have plenty more to add and it would certainly make someone a stronger candidate in my eyes.

I've setup the boilerplate extension on my userspace at github, now filling in a request at for migrating this to gerrit for further development

Wikivoyage uses the concept of pagebanners and horizontal table of contents on each of its page

Wikivoyage in what language? What language editions have been contacted about this proposal?

Please edit this task's description to fix the typos in your proposal.

Wikivoyage in what language? What language editions have been contacted about this proposal?

I'm not sure of all notifications that have been done, but I've seen feedback solicited in the English Wikivoyage pub (, and I posted a link to the phabricator discussion on the Wikivoyage page on meta so that other languages would be notified (

@Wrh2 thanks for sharing the links and @Nemo_bis thanks for the poke, super keen to set @Sumit up for success!

Hey, I have a few suggestions to your proposal:

  1. Use an article keyword like {{DISPLAYTITLE:Abc}} instead of a parser function, as it affects the article's header and will not be replaced by some html but rather modify another part of the page. I'd suggest {{ARTICLEBANNER}} or {{PAGEBANNER}}.
  2. Don't use lua please but fetch the image automatically in the Extension so we won't need any template placed on the pages. The property to use can be specified in the config and you can get the statement for this property by using the Wikibase Extension in your PHP code.
  3. Don't add all those symbols by wikitext, but use Wikidata's badges instead which can also be fetched automatically in your PHP code. Some of them don't exist on Wikidata yet so they should be created and added to the configuration. This requires a task on the Wikidata board.
  4. Add the banner via CSS, not as an <img> tag. This way we can easily configure the size of the image by creating responsive css rules with @media queries. We can also easily create a different stylesheet for the MobileFrontend extension.
  5. Concerning the edit box, as it should also be possible to edit Wikidata in this box, please work closely with the Wikidata team for that feature.

@Bene, thanks for your suggestions. Just a small view regarding:

Concerning the edit box, as it should also be possible to edit Wikidata in this box, please work closely with the Wikidata team for that feature.

The current pagebanner template uses a different url in wikitext(as a parameter) to specify an alternative pagebanner, different from wikidata value. As per my plan, the edit feature targets to replace this url in the wikitext(using a UI), to make only local changes, keeping the wikidata value intact. If this scheme does not look right, I'll change it to editing the wikidata value. Views?

I'm not sure if we need an edit widget for changes to the wikitext variable, maybe something that hooks into VisualEditor would be nice like it is done for {{DISPLAYTITLE}} already.

Changing the value on Wikidata requries more investigation because it will affect all wikis which have an article about that topic and are linked to Wikidata. I'm not sure how to find a nice solution here. I think you should focus on a VisualEditor integration and leave the Wikidata remote editing as a todo for later if there is still time left.

I'm still not seeing which Wikivoyage edition(s) volunteered to test/adopt this extension.

@Sumit my opinion on Phase V: I think you should de-scope this from your GSoc proposal. {{PAGEBANNER}} should be completely optional and simply used for overriding the value from Wikidata. For this reason I think an editor might not make sense here as a first version. Clicking an "Edit on Wikidata" link might suffice. It would be far better to have a generic image selector on Wikidata itself or fallback to VE. I really think the phases before it are ample work for a GSoc project already :-)

@Jdlrobson, descoped the "editing of banner image source using UI" part of the proposal as per your suggestion.

@Qgil, since we are asking students to keep their proposal task as their "Detailed plan with mentors" in T94166 I don't think we should be closing these as resolved yet.

  1. Add the banner via CSS, not as an <img> tag. This way we can easily configure the size of the image by creating responsive css rules with @media queries. We can also easily create a different stylesheet for the MobileFrontend extension.

It's actually better to use an img and use the srcset attribute. This is how we should configure the size of the image. I've suggested @Sumit switches back to using an img tag