Extension:MobileFrontend
MobileFrontend 확장은 미디어위키 인스턴스의 모바일 존재감을 개선하는 데 도움이 됩니다.
이 확장은 Web team에 의해 유지 관리됩니다. |
특징은 다음과 같습니다:
- 모바일 트래픽에 대해 분리된 모바일 사이트를 만듭니다.
- 시스템 관리자는 다른 스킨, 예를 들어 mw:Skin:MinervaNeue을 제공할 수 있습니다.
- 다양한 컨텐츠 변환 기능을 제공하여 당신의 컨텐츠를 보다 친숙하게 만듭니다.
- 특히 섹션 접기 그리고 컨텐츠 재배치 그리고 제거.
- 모바일 바닥글을 단순화하고 데스크탑/모바일 사이트 링크를 추가합니다.
- 모바일 친화적이지 않은 미디어위키 페이지에 대해 대체 특수 페이지를 제공합니다 – Special:History, Special:Contributions, Special:Watchlist, Special:Preferences, Special:MobileDiff.
- 그것은 다음 특수 페이지를 제공합니다: Special:Nearby, (모바일 스킨 설정에 대해) Special:MobileOptions, (언어 선택에 대해) Special:MobileLanguages, (모바일 스틴에서 non-JS 메뉴에 대해) Special:MobileMenu 그리고 (모바일 친화적 이미지 업로드 보기에 대해) Special:Uploads.
이 기사는 그들 개발 예제에 그것을 설치하기 원하는 최종 사용자에 대해 설계되었습니다. 만약 여러분이 그것을 구축하고 그것을 개선하기 위해 우리를 돕고 싶다면 우리는 당신의 참여를 권장합니다.
Prerequisites
모바일프론트엔드를 설치하기 전에, 만약 템플릿 및/또는 인라인 스타일 (스타일 속성)을 많이 사용한다면, 그것이 모바일 친화적인지 여부를 보기 위해 컨텐츠를 검토해야 합니다. TemplateStyles 확장은 모바일과 데스크탑에서 멋지게 렌더링하도록 컨텐츠에 스타일을 맞추도록 사용될 수 있습니다. 모바일프론트엔드는 마술처럼 이것을 고쳐주지는 않을 것입니다!
특히, 방문 페이지 (메인 페이지)를 검토하기를 원할 수 있습니다. 모바일 홈페이지 형식화를 참조하십시오.
Installation
미디어위키 확장 내려받기 지면에서 해당하는 버전을 다운로드하고 위키의 extensions 디렉토리에 MobileFrontend에 푸십시오.
또는 개발자와 코드 기여자는 대신 다음을 사용하여 Git에서 확장 프로그램을 설치해야 합니다.
cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MobileFrontend
미디어위키 설정 LocalSettings.php에 다음을 추가하십시오:
wfLoadExtension( 'MobileFrontend' );
Special:Version에 접근해서 확장이 정상적으로 설치가 되었는지 확인하십시오.
Vagrant installation
만약 Vagrant를 사용하면, vagrant roles enable mobilefrontend --provision을 사용하여 설치하십시오.
Setup Nearby
모바일프론트엔드는 약간의 구성과 함께 Special:Nearby 지면을 제공합니다. 이 기능을 사용하기 위해서, 몇 가지 선택적 단계가 요구됩니다:
- 브라우저 보안으로 인해 SSL을 통해 보안 사이트를 실행할 필요가 있습니다 – 상대적으로 보안성이 약한 http를 통해 사용자의 위치를 요청할 수 없습니다.
- GeoData extension을 설치하십시오.
- update.php를 실행하십시오.
LocalSettings.php파일에$wgMFNearby = true;설정을 추가하십시오.- 기사 좌표를 결정합니다:
- Add location data to your articles by using the
coordinatesparser function, for example{{#coordinates:37.786971|-122.399677|primary}}. For syntax details, see the documentation for GeoData. - Alternatively, you can use a separate MediaWiki installation for Nearby by setting
$wgMFNearbyEndpointin yourLocalSettings.phpfile. 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.
- Add location data to your articles by using the
Setup a skin
모바일프론트엔드는 기존의 데스크탑 웹 사이트와 나란히 가기 위해 모바일 형식의 웹 사이트를 제공합니다. 원하는 스킨을 적용할 수 있습니다.
// Choose one of these pairs of lines and add chosen code to bottom of LocalSettings.php file:
wfLoadSkin( 'MinervaNeue' );
$wgDefaultMobileSkin = 'minerva'; // use Minerva skin (You need to download and install it separately in 1.37 and older, otherwise you'll get an exception)
wfLoadSkin( 'Vector' );
$wgDefaultMobileSkin = 'vector'; // use Vector skin
wfLoadSkin( 'Timeless' );
$wgDefaultMobileSkin = 'timeless'; // use Timeless skin
The following skins are compatible with MobileFrontend:
- mw:Skin:Minerva Neue (안정적, WMF 위키들의 모바일 기본값)
- mw:Skin:Vector (데스크탑 스킨의 기본값, 모바일에 대해 실험적인 반응이 빠른 모드를 사용함)
- mw:Skin:Timeless (실험적인 스킨)
- Skin:MonoBook
- Skin:Citizen (responsive skin)
Configuration settings
See Extension:MobileFrontend/Configuration
All configuration options are detailed in the README.md file.
Additional tweaks
이러한 다른 선택적인 종속성을 더함으로써 모바일프론트엔드를 최대한 활용하십시요:
- Extension:GeoData - Special:Nearby과 여러분 기사의 geotag을 얻습니다.
- Extension:PageImages - 검색과 근처 결과에 대해 이미지를 더합니다.
- Extension:VisualEditor - 모바일 환경에서 시각 편집기를 더합니다.
Local customisations
CSS styling
| MediaWiki version: | ≤ 1.40 |
To apply CSS to your mobile theme, edit MediaWiki:Mobile.css, the counterpart of MediaWiki:Common.css.
In order for the stylesheet to function you may have to add mw.loader.using('mobile.site.styles') to your MediaWiki:Mobile.js.
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 URL query string: ?useformat=mobile. For example: https://en.wikipedia.org/wiki/MediaWiki?useformat=mobile
If you would like to view the mobile version of a page without enabling the extension across the entire site you can append the string to the URL on that page, too.
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.
API
APIs are provided by the MobileFrontend extension, but long term we expect to deprecate them in favour of Page Content Service. Use these APIs at your own risk. They may disappear (although we will give you sufficient notice when they do)!
MobileView API
This feature was removed completely in version 1.39. |
See Extension:MobileFrontend/MobileViewAPI.
Extended action=parse
action=parse accepts extra parameters:
mobileformat=- Return rendered page HTML in a mobile format 1.23+.
mainpage- Apply mobile main page transformations.
Example:
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
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 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)
See Extension:MobileFrontendContentProvider.
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. See Extension:MobileFrontend/Configuring browser auto-detection.
$wgMFMobileHeader = 'X-WAP'; or modify your cache (Varnish) header setting, as long as they match.Using Apache (.htaccess or httpd.conf)
To set up a mobile domain, add the following rule to .htaccess or http.config
<IfModule mod_headers.c>
<If "req('Host') =~ /^mobile./i">
RequestHeader set X-Subdomain "mobile"
</If>
</IfModule>
In your hosts file (assuming your desktop site is on localhost):
127.0.0.1 mobile.localhost
In LocalSettings.php:
wfLoadExtension('MobileFrontend');
$wgMFAutodetectMobileView = true;
$wgMobileUrlCallback = fn( $domain ) => "mobile.$domain";
Now if you navigate to mobile.localhost you should see the mobile site.
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 Skin:Minerva Neue skin installed. If you don't you'll need to install this or configure your mobile 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 this guide on writing MobileFrontend friendly modules will be of help.
See also
- Mobile web browsers supported by MobileFrontend
- Extension:TextExtracts
- Commons:Category:MediaWiki extension MobileFrontend
- Extension:MobileDetect
- Extension:Progressive web application: turn any wiki into a mobile app
References
이 확장은 하나 이상의 위키미디어 프로젝트 또는 다움위키에서 사용되고 있습니다. 이것은 아마도 확장이 안정적이고 높은-트래픽 웹 사이트에서 사용되기에 충분히 잘 작동한다는 것을 의미합니다. 위키미디어의 CommonSettings.php 및 InitialiseSettings.php 구성 파일에서 이 확장의 이름을 찾아 설치 위치를 확인하십시오. 특정 위키에 설치된 확장의 전체 목록은 위키의 Special:Version 페이지에서 볼 수 있습니다. |