Wikitia:MobileFrontend

From Wikitia
Jump to navigation Jump to search

<languages /> <translate> The MobileFrontend extension:

  • Creates a separate mobile site for your mobile traffic.</translate>

<translate>

    • system administrators are able to provide a different skin e.g. Skin:MinervaNeue</translate>

<translate>

  • provides various content transformations to make your content more friendly</translate>

<translate>

    • notably section collapsing and content re-arrangement and removal.</translate>

<translate>

    • simplifies mobile footer and adds a desktop/mobile site link</translate>

<translate>

<translate>

<translate>

  • Provides a beta mode with a feature management system for adding experimental features for anonymous users.

</translate>


MediaWiki extensions manual
OOjs UI icon advanced.svg
MobileFrontend
Release status: stableLua error: callParserFunction: function "#translation" was not found.[[Category:stable extensions{{#translation:}}]]
MediaWiki-Vagrant MobileFrontend Extension.png
Implementation Lua error: callParserFunction: function "#translation" was not found.
Description <translate> Provides a mobile-friendly view</translate>
Author(s)
Latest version Lua error: callParserFunction: function "#translation" was not found.
Compatibility policy release branches
MediaWiki 1.33+[1]
PHP 5.5.9+
Database changes Lua error: callParserFunction: function "#translation" was not found.
License Lua error: callParserFunction: function "#translation" was not found.
Download [[Category:Extensions in Wikimedia version control{{#translation:}}]]
README
Example m.mediawiki.org
Translate the MobileFrontend extension if it is available at translatewiki.net
Issues Open tasks · Report a bug

[[Category:All extensions{{#translation:}}]]

<translate> This page is designed for end users who want to install it on their development instance. If you are keen to help us build it and improve it we encourage you to get involved. </translate>

<translate>

Prerequisites

  • Although MediaWiki does not require it, PHP must have <tvar|mbstring>mbstring</> support for this extension to work (task T62174).

Before installing MobileFrontend, if you make heavy use of templates and/or inline styles (the style attribute) you should review your content to see whether it is mobile friendly.</translate> <translate> The TemplateStyles extension can be used to style content so that it renders nicely on mobile and desktop. MobileFrontend will not magically fix this for you!

In particular, you may want to review your landing page (main page).</translate> <translate> See Mobile homepage formatting.

Installation

</translate>


  • If using Vagrant , install with vagrant roles enable mobilefrontend --provision
Manual installation
  • Download and place the file(s) in a directory called MobileFrontend in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'MobileFrontend' );
    
    <translate>
  • [[<tvar|1>#Configuration settings</>|If necessary configure at your convenience]]</translate>
  • checkY Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

<translate>

Setup Nearby

MobileFrontend provides the Special:Nearby page with a little configuration. To get this to work a few optional steps are required:

  1. Due to browser security you will need to be running a secure site over SSL — it is not possible to request a user's location over HTTP.</translate>

<translate>

  1. Install the GeoData extension
  2. Run update.php
  3. In LocalSettings.php add $wgMFNearby = true;
  4. Determine article coordinates:
    1. Add data to your articles to one or more pages {{#coordinates:37.786971|-122.399677|primary}} see the documentation for GeoData for syntax details.
    2. Alternatively you can use a separate MediaWiki installation for Nearby by setting $wgMFNearbyEndpoint in your LocalSettings.php file. For example, $wgMFNearbyEndpoint = 'https://en.m.wikipedia.org/w/api.php'; will use coordinates of English Wikipedia articles. The nearby endpoint will be used to find content related to a given location.

</translate>

<translate>

Setup a skin

MobileFrontend provides you with a mobile formatted website to go alongside your existing desktop website. You can skin it however you want. </translate>

 // Choose one of these and add chosen code to bottom of LocalSettings.php file:
 wfLoadSkin( 'MinervaNeue' );
 $wgMFDefaultSkinClass = 'SkinMinerva'; // use Minerva skin (You need to download and install it separately, otherwise you'll get an exception)
 wfLoadSkin( 'Vector' );
 $wgMFDefaultSkinClass = 'SkinVector'; // use Vector skin
 wfLoadSkin( 'Timeless' );
 $wgMFDefaultSkinClass = 'SkinTimeless'; // use Timeless skin

<translate> The following skins are compatible with MobileFrontend:

Configuration settings

See <tvar|1>Extension:MobileFrontend/Configuration </>

Additional tweaks

Get the most out of MobileFrontend by adding these other optional dependencies: </translate>

<translate>

Local customisations

CSS styling

To apply CSS to your mobile theme, edit MediaWiki:Mobile.css, the counterpart of MediaWiki:Common.css.

MobileFrontend does not load the global MediaWiki:Common.css, neither does it load any of the user stylesheets.

More information

If you would like to test the mobile extension on a desktop browser or your device doesn't render the mobile version, you can append the following key-value pair to the query string: ?useformat=mobile e.g., https://en.wikipedia.org/wiki/Chuck_Schuldiner?useformat=mobile

If you would like to view a page in the beta without enabling it across the entire site you can append to the query string of any page

Legacy features of MobileFrontend

MobileFrontend has traditionally been a very large extension. Many features have either surpassed their requirements or will do at some future date. These are listed below. </translate>

<translate>

API

APIs are provided by the MobileFrontend extension, but long term we expect to deprecate them in favour of Mobile Content Service. Use these APIs at your own risk. They may disappear (although we will give you sufficient notice when they do)!

MobileView API

See {{<tvar|1>ll|Extension:MobileFrontend/MobileViewAPI</>|Extension:MobileFrontend/MobileViewAPI}}.

Extended <tvar|parse>action=parse</>

action=parse accepts extra parameters:

mobileformat=
Return rendered page HTML in a mobile format 1.23+. Prior to MediaWiki 1.23, you could specify mobileformat=html to output HTML for modern phones or mobileformat=wml to output WML for dumb phones (see mailing list messagefor details).
noimages
Disable images in mobile output.
mainpage
Apply mobile main page transformations.

Example: </translate>

Result
{
    "parse": {
        "title": "Therion (band)",
	    "text": {
            "*": "<div><table class=\"infobox vcard plainlist\" style=\"width:22em\"><tr><th colspan=\"2\" style=\"text-align:center;font-size:125%;font-weight:bold;background-color: #b0c4de\"><span class=\"fn org\">Therion</span></th>\n</tr><tr><td colspan=\"2\" style=\"text-align:center\"><a href=\"/wiki/File:2130860153_281d30b3bf_b.jpg\" class=\"image\">
            ...

meta=siteinfo

<translate> The domain of the mobile version of the site (which might or might not be the same as the normal domain) is available under the mobileserver key of the general siteinfo information.

For developers/sysadmins

Setup

You may need to run <tvar|1>npm install</> and install php composer to get the precommit hook to run, depending on what you're doing with the extension.

Testing with articles on a foreign wiki (live data)

MobileFrontend can now be configured locally to render articles from other MediaWiki instances.[2] This can help you debug problems locally instead of importing articles which may have dependencies on various templates and Wikibase identifiers from production to your local instance. This is not recommended for production usage.

The code below will turn your local MediaWiki mobile site into a Wikivoyage viewer: </translate>

$wgMFContentProviderClass = 'MobileFrontend\ContentProviders\MwApiContentProvider';
$wgMFMwApiContentProviderBaseUri = 'https://en.m.wikivoyage.org/w/api.php';

<translate> This is particularly useful for testing different mobile skins using the wgMFDefaultSkinClass config option.

Using the mobile view

WMF sites

On Wikimedia Foundation-run sites, we use Varnish caching servers to check the user agent of your device.

Non-WMF sites

For non-WMF sites, you can either set up your configuration to mimic how things are done at the WMF (doing device detection at the proxy layer and setting specific X-Device headers), or you can simply use "?useformat=mobile" to switch an article to use the mobile view. </translate>

<translate> Starting from the snapshot version 1.28, the default $wgMFMobileHeader was changed from X-WAP to X-Subdomain.</translate> <translate> You could either set <tvar

<translate>

FAQ

The following questions frequently appear on our talk page. Please check this list before posting about them on the talk page or use the existing talk topic, if available, to receive clarifications.

Q: How do I customise the main menu of the Minerva skin?

A: This is tracked in phabricator but you can see Topic:Tiggc18fvd3stmsf has an interim solution.

Q: How do I add HTML to the Minerva skin, for example to add ads or additional script tags?

A: You can do this by editing the template file for the skin (currently include/skins/minerva.mustache). See this discussion for details.

Q: The extension I am using doesn't seem to work on MobileFrontend. Why?

A: It's likely the extension is old and needs to add compatibility to MobileFrontend. Please contact the developer of the extension and point them to ResourceLoader/Writing a MobileFrontend friendly ResourceLoader module. Please do not post to the talk page, as in this case it would be better to file a bug on Phabricator (you can login using your MediaWiki.org username) for a quicker response.

Q: I upgraded MobileFrontend and now I'm getting a fatal exception!

A: You are probably using incompatible versions of MobileFrontend and MediaWiki. In most cases, we can't help you here. Try upgrading MobileFrontend or MediaWiki to resolve your issue.

Q: After upgrading MediaWiki I'm getting an exception wgMFDefaultSkinClass is not setup correctly.

A: MobileFrontend currently assumes you have the <tvar|1>Skin:Minerva Neue </> skin installed. If you don't you'll need to install this or configure your mobile skin [[<tvar|2>#Setup a skin</>|per instructions above]].

For Extension Developers

By default resource modules in extensions will not be loaded in mobile view.

Should a module need to be loaded while in mobile view [[<tvar|1>Special:MyLanguage/ResourceLoader/Writing a MobileFrontend friendly ResourceLoader module</>|this guide on writing MobileFrontend friendly modules]] will be of help.

See also

</translate>

<translate>

References

</translate>

  1. :Fatal error: Uncaught ExtensionDependencyError: MobileFrontend is not compatible with the current MediaWiki core (version 1.32.2), it requires: >= 1.33.0.
  2. See this YouTube demo video

[[Category:Skins used on Wikimedia{{#translation:}}|MobileFrontend]]

[[Category:ListDefinedTags extensions{{#translation:}}]] [[Category:Mobile skins{{#translation:}}| ]]