Extension:Add HTML Meta and Title/zh

From mediawiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:Add HTML Meta and Title and the translation is 0% complete.
MediaWiki擴充功能手冊
OOjs UI icon advanced-invert.svg
Add HTML Meta and Title
发布状态: 稳定版
实现 标签
描述 Allows for easier SEO (search engine optimization) with MediaWiki.
作者 Jim Wilson, Dennis Roczek (dennisroczek讨论)
最新版本 0.7 (2015-09-29)
MediaWiki 1.24+
数据庫更改
许可协议 MIT授權條款
下载
‎<seo>
翻譯Add HTML Meta and Title擴充功能如在translatewiki.net可用

检查使用和版本矩阵。

The Add HTML Meta and Title extension allows for easier SEO (search engine optimization) with MediaWiki. It is based in part on the extension MetaKeywordsTag .

When you enter the following in a wiki page:

<seo title="word1,word2" metakeywords="word3,word4" metadescription="word5,word6" google-site-verification="123456789-abfd123456" />

...or the shorter...

<seo title="word1,word2" metak="word3,word4" metad="word5,word6" google-site-verification="123456789-abfd123456" />

...these words are added to the HTML title and meta headers. This makes SEO (search engine optimization) with MediaWiki easier.

For example, the above would become:

<title>word1,word2 - Wiki Name</title>         (the string "word1,word2" replaces page title)
<meta name="keywords" content="word3,word4" />
<meta name="description" content="word5,word6" />
<meta google-site-verification="123456789-abfd123456" />

(These are new meta tags - existing metas are left untouched.)

Installation

  • 下载文件,并将其放置在您extensions/文件夹中的AddHTMLMetaAndTitle目录内。
  • 将下列代码放置在您的LocalSettings.php的底部:
    wfLoadExtension( 'AddHTMLMetaAndTitle' );
    
  • Yes 完成 – 在您的wiki上导航至Special:Version,以验证扩展已成功安装。

致使用MediaWiki 1.30或更早版本的用户:

上面的说明介绍的是安装此扩展的新方法,它使用wfLoadExtension()。 如果您需要在早期版本(MediaWiki 1.30和更早版本)中安装此扩展,而不是wfLoadExtension( 'AddHTMLMetaAndTitle' );,您需要使用:

require_once "$IP/extensions/AddHTMLMetaAndTitle/AddHTMLMetaAndTitle.php";

Changelog

v0.7.0
  • added support for PHP CodeSniffer checks.
  • fixed any remaining errors and warnings.
v0.6.0
  • added Google's site verification tag.
v0.5.1
  • modified to work with MW versions 1.1.2 and up (Revision by Mic)
v0.4.0
  • have put $emt=""; in the parseSEO function because I got some nasty PHP notice for an unitialised variable...
v0.2.0
  • added htmlspecialchars() as a filter to the text that is displayed in the title and meta - anything else needed to prevent malicious people? I think no. (If you are an English speaker you may want to use the htmlentities PHP function, which is more restrictive.)
v0.1.0
  • Initial version - everything works.

See also