Extension:Add HTML Meta and Title

From MediaWiki.org

Jump to: navigation, search

This extension allows for easier SEO (search engine optimization) with MediaWiki.

Manual on MediaWiki Extensions
List of MediaWiki Extensions
Add HTML Meta and Title

Release status: beta

Implementation Tag
Description This extension allows for easier SEO (search engine optimization) with MediaWiki.
Author(s) Vladimir Radulovski (Владимир Радуловски Talk)
Version 0.5
MediaWiki 1.6.x, 1.8.x, 1.9.x or higher
Download http://velko.org/mediawiki/extensions_download/Add_HTML_Meta_and_Title.phps - rename it to work
Example http://bulg.dk/Потребител_беседа:Raimax

Contents

[edit] Usage

When you enter

<seo title="word1,word2,..." metakeywords="word1,word2,..." metadescription="word1,word2,..." />

...or the shorter...

<seo title="word1,word2,..." metak="word1,word2,..." metad="word1,word2,..." />

in a wiki-article some 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>Original title, word1,word2,...</title>         (the string ", word1,word2,..." is added)
<meta name="keywords" content="word1,word2,..." />     

(this is a new meta tag - existing metas are left untouched)

[edit] How I did it

This extension uses two MediaWiki hooks - OutputPageBeforeHTML (for meta) and BeforePageDisplay (for title addition).

I've expanded the code of Extension:MetaKeywordsTag and due to the more capabilities of my version I decided to create a new extension. One day it may become the standard way for MediaWiki SEO, who knows :)

[edit] License

Add HTML Meta and Title is released under The MIT License.

[edit] Installation and Download

[edit] Changelog

[edit] v0.4

  • have put $emt=""; in the parseSEO function because I got some nasty PHP notice for an unitialised variable...

[edit] v0.2

  • 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)

[edit] v0.1

  • Initital version - everything works.
Personal tools