扩展:RelatedArticles
Support level: Pending The support level for this extension is currently under review. The Reader Growth Team is the maintainer of last resort for the time being. |
发行状态: 稳定版 |
|
|---|---|
| 实现 | 解析器函数, API |
| 描述 | Adds a link to related pages on the footer |
| 作者 | Reader Growth Team |
| 最新版本 | 3.1.0 (Continuous updates) |
| MediaWiki | >= 1.44 |
| PHP | 5.4+ |
| 数据库更改 | 否 |
|
|
| 许可协议 | GNU通用公眾授權條款2.0或更新版本 |
| 下載 | CHANGELOG |
| 帮助 | Help:Extension:RelatedArticles/zh |
| 前往translatewiki.net翻譯RelatedArticles扩展 | |
| 問題 | 开启的任务 · 报告错误 |
The RelatedArticles extension adds a parser function to your wikitext that allows associating related articles with your article. It shows related pages as a list of articles and their descriptions at the bottom of a page on desktop and mobile. The extension is also smart enough to get the list of related articles using the morelike feature of CirrusSearch.


安装
- 下载文件,并解压
RelatedArticles文件夹到extensions/目录中。
开发者和代码贡献人员应改从Git安装此扩展,输入:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/RelatedArticles
- 請新增下列代码到您的LocalSettings.php文件的底部:
wfLoadExtension( 'RelatedArticles' );
完成 – 請导航至您的wiki上的Special:Version,以验证此扩展已成功安装。
If you use something other than w/api.php for your API, and related pages is not showing, check for any bad requests in your browser network tab.
If necessary, the API used to obtain related articles is configurable with $wgRelatedArticlesUseCirrusSearchApiUrl
额外部署请求
RelatedArticles can optionally provide additional features if the extensions below are installed:
- If PageImages is installed, Related Articles will include the page's selected image (if any). Otherwise, a placeholder image will be used instead.
- If EventLogging is installed, the RelatedPages feature can be configured to log events. See below for configuration manual.
- Depending on the configuration of
$wgRelatedArticlesDescriptionSource, a small description of each page can be fetched. See the configuration manual below for required extensions. Descriptions won't be provided if the specified extension isn't installed.
用法
Once installed, related articles will be determined algorithmically based on CirrusSearch if available, with no additional steps. Alternatively, you can disable this functionality ($wgRelatedArticlesUseCirrusSearch) and manually add related articles like so:
{{#related:Test with read more}}
{{#related:Another test page}}
Configuration
- Related articles will be shown at the bottom of the skin. Note that the page must be in the Main namespace, and being
viewed (as opposed toedited for example), and not be a disambiguation or a diff page, and the skin name (e.g.minerva) that's being used is in the array$wgRelatedArticlesFooterAllowedSkins(see below).
The following configuration options apply:
- If EventLogging is installed, set the event logging sampling rate
$wgRelatedArticlesLoggingSamplingRateusing a number between 0 and 1. The schema used for logging is RelatedArticles . - Use morelike feature of CirrusSearch by setting
$wgRelatedArticlesUseCirrusSearchtotrue. If CirrusSearch is not available fallback to using the related articles marked in wikitext. - Use only CirrusSearch's morelike feature by setting
$wgRelatedArticlesOnlyUseCirrusSearchtotrueignoring the related articles marked in wikitext. $wgRelatedArticlesFooterAllowedSkinsList of skin names (e.g. 'minerva', 'vector') where related articles will be shown in the footer. For example, on a wiki with MonoBook, Vector and Minerva installed,$wgRelatedArticlesFooterAllowedSkins = ['vector']will result in the widget showing on Vector only. The skin names have to all be in lowercase, e.g. 'vector' not 'Vector', even if the skin directory is 'Vector'. In versions prior to 1.37.0-wmf.3, this is named$wgRelatedArticlesFooterWhitelistedSkins.- A small description of the page will be displayed below the title of the page, depending on the value of
$wgRelatedArticlesDescriptionSource:wikidata: Requires Wikibase Client, from the central wikibase repository or Extension:ShortDescription.textextracts: Requires Extension:TextExtracts, fetched from the prop=extracts api.pagedescription: Requires Extension:Description2 (or any other extension that sets thedescriptionpage property).
For development
For development the following configuration is recommended:
$wgRelatedArticlesUseCirrusSearchApiUrl = 'https://en.wikipedia.org/w/api.php';
$wgRelatedArticlesUseCirrusSearch = true;
$wgRelatedArticlesFooterAllowedSkins = [ 'vector-2022', 'vector', 'minerva', 'timeless' ];
$wgRelatedArticlesDescriptionSource = 'wikidata';
RelatedPages
The Related Pages feature is implemented in this extension. More info about its development can be found at phab:T94906.
On Wikimedia Projects
Related pages is enabled on:
- All Wikipedias, when using Minerva and Timeless skins (except dewiki where they disabled it on Timeless skin), and for hewiki and htwiki, Vector
- All Wikivoyages, when using Minerva, Timeless and Vector
- eswikinews, frwikinews and zhwikinews, for all skins
Feedback
- Create a task in Wikimedia's issue tracker under the "RelatedArticles" project.
- Check the list of existing RelatedArticles tasks
Help
See also
- $wgVectorSearchRecommendationsApiUrl is a setting in Vector, which can shows related pages in search bar without using RelatedArticles extension. Only Vector 2022 is supported.
| 此扩展用于一个或多个维基媒体项目。 这可能意味着扩展足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php配置文件中查找此扩展的名称以查看哪些网站安装了该扩展。 特定wiki上的已安装的扩展的完整列表位于Special:Version页面。 |
| 此扩展在以下wiki农场/托管网站和/或软件包中提供: |
- Extensions maintained by Reader Teams/zh
- Extensions maintained by Reader Growth/zh
- Extensions maintained by Reader Teams - Level Pending/zh
- Stable extensions/zh
- Parser function extensions/zh
- API extensions/zh
- BeforePageDisplay extensions/zh
- ParserFirstCallInit extensions/zh
- ResourceLoaderGetConfigVars extensions/zh
- SkinAfterContent extensions/zh
- GPL licensed extensions/zh
- Extensions in Wikimedia version control/zh
- All extensions/zh
- Extensions used on Wikimedia/zh
- Extensions included in Canasta/zh
- Extensions included in Miraheze/zh
- Extensions included in MyWikis/zh
- Extensions included in ProWiki/zh
- Extensions included in wiki.gg/zh
