您可以使用 CSS 删除任何主题或皮肤的页脚:每个 wiki 后面的 MediaWiki 数据库中都内置了一个通用 CSS 文件:
http://<your-site>/wiki/index.php/MediaWiki:Common.css
在浏览器中输入该链接以转到该页面。然后点击“编辑”链接编辑该页面并将这一行添加到页面中:
#footer { display: none; }
注意:您可能不想删除整个页脚。您可以通过在 WikiMedia:Common.css 中输入单个组件来删除它们:
/* last modification stuff */
#footer-info { display: none; }
/* footer links */
#footer-places { display: none; }
/* powered by icon */
#footer-icon { display: none; }
就个人而言,我会保留包含 Powered by MediaWiki 图标的页脚图标,并在应有的地方给予赞扬。
如果您使用的是 MobileFrontend 扩展,那么您还需要将相同的行添加到:
http://<your-site>/wiki/index.php/MediaWiki:Mobile.css
您要删除维基媒体页脚还是只更改它?
我可以看到想要删除部分默认页脚,例如最后一个修改字符串。你可以使用 CSS 来隐藏它,就像我上面提到的,或者你可以在浏览器中输入这个 URL:
http://<your-site>/wiki/index.php/MediaWiki:Lastmodifiedat
编辑该页面并删除那里的行,然后保存该页面。 最后修改内容将从您的 wiki 页面中消失。
但页脚链接部分可能非常有用。如果您想CHANGE 页脚链接,MediaWiki 文档中提供了一个挂钩 (SkinTemplateOutputPageBeforeExec):
https://www.mediawiki.org/wiki/Manual%3AFooter#Add_links_to_the_footer
如果您想删除现有的页脚链接并添加您自己的新的页脚链接,请按照嵌入式 cmets 中的说明操作,然后将此 PHP 代码添加到您的 LocalSettings .php 文件:
# Remove all existing footer links and add my own
$wgHooks['SkinTemplateOutputPageBeforeExec'][] = function( $sk, &$tpl ) {
# IMPORTANT: this is the secret sauce - remove all existing footer links
$tpl->data['footerlinks']['places'] = array();
# To add new footer links to local wiki pages:
#
# 1) You MUST create your new pages in your (Main) namespace first, for example:
#
# http://<your-site>/wiki/index.php/About_Us
# http://<your-site>/wiki/index.php/Contact_Us
# http://<your-site>/wiki/index.php/Disclaimer
# http://<your-site>/wiki/index.php/Download
# http://<your-site>/wiki/index.php/Privacy_Policy
#
# 2) You MUST then create each of these pages in your MediaWiki namespace:
#
# http://<your-site>/wiki/index.php/MediaWiki:Aboutpage
# - Insert 1 line, with "About Us" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Contactpage
# - Insert 1 line, with "Contact Us" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Disclaimerpage
# - Insert 1 line, with "Disclaimer" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Downloadpage
# - Insert 1 line, with "Download" (no quotes)
# http://<your-site>/wiki/index.php/MediaWiki:Privacypage
# - Insert 1 line, with "Privacy Policy" (no quotes)
#
# 3) Add new footer links like this:
$tpl->set( 'aboutpage', $sk->footerLink( 'aboutpage', 'aboutpage' ) );
$tpl->data['footerlinks']['places'][] = 'aboutpage';
$tpl->set( 'contactpage', $sk->footerLink( 'contactpage', 'contactpage' ) );
$tpl->data['footerlinks']['places'][] = 'contactpage';
$tpl->set( 'disclaimerpage', $sk->footerLink( 'disclaimerpage', 'disclaimerpage' ) );
$tpl->data['footerlinks']['places'][] = 'disclaimerpage';
$tpl->set( 'downloadpage', $sk->footerLink( 'downloadpage', 'downloadpage' ) );
$tpl->data['footerlinks']['places'][] = 'downloadpage';
$tpl->set( 'privacypage', $sk->footerLink( 'privacypage', 'privacypage' ) );
$tpl->data['footerlinks']['places'][] = 'privacypage';
return true;
};
重要提示:不要忘记按照说明创建您自己的页面和相应的 MediaWiki 重定向,否则您的链接可能不会显示或它们可能被破坏。