Mobile Gateway/Mobile homepage formatting/lb

Wann d'Haaptsäit (homepage) vun Ärem Wikimedia-Projet net formatéiert ass fir op mobilen Apparater gewisen ze ginn, a wann Dir en Administrateur vun deem Projet sidd, da féiert w.e.g. d'Instruktiounen hei drënner aus.

Denkt drun: Dir musst Adminstraursrechter hu fir d'Haapsäit z'änneren

Schrëtt 1
D'éischt musst Dir decidéieren wat fir een Inhalt op déi mobil Haaptsäit gehéiert

Evaluate the page elements in the desktop version (e.g. "Picture of the Day") by asking:


 * how popular are they?
 * are they updated regularly?
 * are they suitable for quick reading?
 * will they fit nicely in a mobile screen?

Wann Dir bis decidéiert huet watfir Elementer Sënn maachen da gitt op de Schrëtt 2.

Schrëtt 2
You must be logged in and have administrative rights to do the following. On the desktop view of the homepage, click "" and find the elements you want to include in the mobile view.

Each element you want excluded from the page should be given a class "nomobile" or wrapped in an element with this class present.



What goes in between the opening and closing div tags? It will most likely be a template for the page element, such as "Picture of the Day".

Updating styles
Certain styles are not mobile friendly. For example any css rules which make use of fixed pixel size e.g. width, height, padding. If different style treatment is needed please use the Extension:TemplateStyles or port these styles to MediaWiki:Common.css or MediaWiki:Mobile.css.

Some tips on common problems are addressed @ Making MediaWiki Mobile Friendly.

Klickt "".

Dir sidd bal fäerdeg.

Schrëtt 3
Now go to the mobile URL, which is typically languagecode.m.project.org. You can reduce the width of your desktop browser to mimic a mobile screen. How does the page look?

Wann Dir Ännerunge maache wëllt da gitt zréck op de Schrëtt 2. Gitt tëscht Schrëtt 2 a Schrëtt 3 hin an hier bis Dir zefridde sidd.

Dat ass alles!

MFSpecialCaseMainPage
When $wgMFSpecialCaseMainPage is enabled (which is disabled by default), it is possible to serve different content to mobile and desktop users. Use of this method is discouraged and deprecated as it only works on the Main Page, is a maintenance burden and should only be used as a stop-gap measure when transitioning your MediaWiki site to a mobile experience. It will be removed in 2020.

The homepages of each language version of Wikipedia and all of the other Wikimedia projects are diverse, so it is impossible to present a universal example. Nevertheless, to give some idea of how this might look on your site, here is the German version of Wikipedia: https://de.wikipedia.org/ If you click on the View source ("Quelltext anzeigen") tab next to "Lesen", you can see the wikitext and using your browser's Find feature, look for the string, "mf-".

In this case, the div tag for the mf selectors are part of larger page objects. Only someone familiar with that project's homepage formatting will understand this in detail.

Gitt elo op: https://de.m.wikipedia.org/

The resulting mobile page will be visible. The sections of content corresponding to the mf selectors are rendered in the mobile view.

Deprecation steps for wikis using MFSpecialCaseMainPage
MobileFrontend is in the process of deprecating the code relating to main page special casing. If you have a wiki using it you'll want to stop using it immediately. If you have any questions please don't hesitate to use the talk page!

How can I tell if I'm using it?
For projects you are users of please apply the query string " " to your main page on mobile and compare it with the main page without the query. For example users of English Wikipedia can compare https://en.m.wikipedia.org/?mfnolegacytransform=1&debug=1 with https://en.m.wikipedia.org/. If the two pages look different you must migrate ASAP.

What can I do to fix this?
Assuming you do not want to do a big redesign and just want to retain the existing main page design, you can follow this guide.

Copy the main page markup into a sandbox e.g. a sub page of the user namespace. Now switch to mobile mode. Note, the mobile site can be viewed in your desktop browser, so if you can you may want to consider using the wikitext editor of the mobile site.

You'll need the TemplateStyles extension deployed on your wiki. You can see if it's installed on your wiki by visiting Special:Version. If it's not for whatever reason please request it.

To add template styles to a page add the following line to the top of your new draft page:

You can now add CSS @media queries to your page by adding CSS inside Template:Main Page/styles.css to display different content to different device resolutions.

You can apply the "nomobile" class to any elements you wish to continue to hide on mobile. In some cases use of this class is the most straightforward way to update your page.

Known problems are listed below:

1. Stop using tables

If your main page uses table's in any way, please remove them. There are many tutorials on the web for doing column layouts. Please put "responsive column layout" into your favorite search engine. If this is confusing, you'll probably want to seek help from a CSS expert!

DivTable converter provides a way for you to convert a table HTML to divs. You should aim to put the associated CSS in MediaWiki:Common.css. This act alone should improve your rendering in mobile greatly.

2. Review any inline styles

Search for any instances of styles which make use of the css properties " ", " ", " " or " "

For example:

Move these into a TemplateStyle. Use a class and move the css declaration to css.

Example CSS:

e.g. Example - note the pre tag is only included for example purposes - this should be put into a TemplateStyle.

3. Reskin for mobile

With the above steps applied your page should look no different on a desktop browser, but as you shrink the screen (horizontal width) to under 720px - the threshold you introduced in step 2 the styles should disappear. You'll want to add new styles (outside the media query you introduced in step 3). These styles will apply to mobile devices and will be overridden.

If there is any content in the page that you do not want to render in the mobile skin you should add the class "nomobile". e.g.

4. Apply the new template

Copy and paste the sandbox page into your Main page. Refresh the browser and verify that it works as expected on both mobile and desktop.

5. Make a site request to turn off main page special casing

If your site is now no longer using the special page casing and your site appears in this config:

You'll want to let a Wikimedia site admin know that you are ready for main page special casing to be turned off. File a Phabricator ticket using this link that links to this web page and lists your wiki.

You'll be able to tell when this has been successful if you've been using the  prefixes as suddenly other content will display on your mobile site!

6. Remove any mobile specific ids.

i.e. any instance of the following:

These are not necessary any more. Previously these would choose which content to show on mobile, but now you have a new mobile first responsive design and have disabled main they will be ignored.

e.g. This example

Quick fix
The quickest possible fix for your wiki might be to fix the design for Minerva only by forcing horizontally stacking at the trade off of impacting the small amount of desktop Minerva users. To see if the quick fix works for you add the following to your Main Page:

and then inside Template:Main_Page/styles.css copy paste the following CSS:

Please be aware that this is a quick and dirty fix, which may break more complex main pages (e.g. ones that use tables within tables), and it also doesn’t improve the current situation where the main page breaks on smaller desktop screens and wastes much space on larger mobile ones. If you really don’t have time, you can use this temporarily, but you should plan to really fix the mobile (and small-screen desktop) experience using the above size-dependent methods (or completely redesign the main page, of course). If you decide to go this way, you should make sure to test the resulting main page using mobile view.