Extension:移动前端/配置

From mediawiki.org
This page is a translated version of the page Extension:MobileFrontend/Configuration and the translation is 100% complete.

移动前端支持多个配置选项,您可以在LocalSettings.php中调用wfLoadExtension( 'MobileFrontend' );require_once "$IP/extensions/MobileFrontend/MobileFrontend.php";后定义这些选项。

请注意,对于一个简单的网站来说,只需加入$wgMFAutodetectMobileView = true;就可以大功告成。

All configuration options

All configuration options are details in the README.md file

配置移动浏览器自动检测

参见配置浏览器自动检测

配置首页

主页面: 移动首页格式

配置皮肤

在本文写作时,扩展前端与Minerva皮肤捆绑。

您可以通过使用配置项$wgDefaultMobileSkin来覆盖

默认情况下,该配置为:

// $wgDefaultMobileSkin = 'vector'; // use Vector skin for your mobile site skin.
// $wgDefaultMobileSkin = 'timeless'; // Use Timeless skin for your mobile site skin.
$wgDefaultMobileSkin = 'minerva'; // Default - use Minerva as your mobile site skin.


开启附近

移动前端提供了“Special:附近”页面,这需要一些配置。为了使其工作,需要一些可选的步骤:

  • 由于浏览器的安全配置,您需要在使用SSL的安全站点上运行:无法通过HTTP请求用户位置
  • 安装GeoData
  • 运行update.php
  • 在LocalSettings.php中加入$wgMFNearby = true;
  • 将数据添加到您的文章到一个或多个页面中,如:{{#coordinates:37.786971|-122.399677|primary}}。有关语法的详细信息,请参见GeoData的文档

另外,您也可以在LocalSettings中加入以下两行中使用外部MediaWiki实例作为“附近”。 附近的端点将用于查找与给定位置相关的内容。

$wgMFNearbyEndpoint = 'http://en.m.wikipedia.org/w/api.php';
$wgMFNearby = true;