Jump to content

手册:页脚

From mediawiki.org
This page is a translated version of the page Manual:Footer and the translation is 72% complete.
Outdated translations are marked like this.

添加链接至注脚

MediaWiki版本:
1.35

或者你一名是站点管理员,希望在LocalSettings.php 中添加它:

; 内部链接
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
    if ( $key === 'places' ) {
        $footerlinks['test'] = Html::rawElement( 'a', [
			'href' => Title::newFromText(
				$skin->msg( 'test-page' )->inContentLanguage()->text()
			)->getFullURL()
		], $skin->msg( 'test-desc' )->escaped() );
    };
};
外部链接
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
    if ( $key === 'places' ) {
        $footerlinks['test'] = Html::rawElement( 'a',
            [
                'href' => 'https://www.example.org/wiki/Project:Imprint',
                'rel' => 'noreferrer noopener' // not required, but recommended for security reasons
            ],
        $skin->msg( 'test-desc' )->escaped() // test-desc is an i18n message of the text
        );
    };
};

In the above examples, "test-page" and "test-desc" are the keys for the system messages added via the code. Do not forget to add the desired text to the pages "MediaWiki:Test-page" and "MediaWiki:Test-desc", respectively, after you added the code for the extra footer links to the "LocalSettings.php" file.


MediaWiki版本:
1.35

You can also add custom text through LocalSettings.php . Here is an example to add wikitext to the footer:

$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
    if ( $key === 'info' ) {
        $footerlinks['tagline'] = $skin->msg( 'footer-tagline' )->parse();
    }
};

This adds footer-tagline as a key for the system message to be displayed in the footer. After adding the code to LocalSettings.php, please edit the MediaWiki:Footer-tagline page to edit the newly-added footer text.

自定义内置项目

您还可以通过修改某些页面或参数自定义单个内置项目:

lastmod
编辑MediaWiki:Lastmodifiedat。如果启用了$wgMaxCredits 的话,也请编辑MediaWiki:Lastmodifiedatby。您也可以编辑MediaWiki:othercontribs,其显示其他贡献(6518
credits
  • 如果$wgMaxCredits非零,它将显示页面编辑器
  • 就是设置$wgMaxCredits = 10;或任何其他数值
copyright
edit MediaWiki:Copyright. The parameter $1 on that page is replaced with a link to the details of copyright for your wiki. In LocalSettings.php $wgRightsText for the link text and set either $wgRightsPage or $wgRightsUrl with the location of a wiki page or external URL.
privacy
这只是一个链接。编辑MediaWiki:Privacy来自定义链接显示的文本,编辑MediaWiki:Privacypage来自定义链接到哪个wiki页面。
about
这只是一个链接。编辑MediaWiki:Aboutsite来自定义链接显示的文本,编辑MediaWiki:Aboutpage来自定义链接到哪个wiki页面。
disclaimer
这只是一个链接。编辑MediaWiki:Disclaimers来自定义链接显示的文本,编辑MediaWiki:Disclaimerpage来自定义链接到哪个wiki页面。
tagline
目前不在注脚中使用 If you would like to add text to the footer, see #Add text to the footer.

要完全删除“隐私政策”、“关于”、“免责声明”链接,可以将链接文本替换为单破折号“-”。

图片

参见$wgFooterIcons

参见