Extension:Add HTML Meta and Title
From MediaWiki.org
|
Release status: beta |
|||
|---|---|---|---|
| Implementation | Tag | ||
| Description | This extension allows for easier SEO (search engine optimization) with MediaWiki. | ||
| Author(s) | Vladimir Radulovski (Владимир РадуловскиTalk) | ||
| Last Version | 0.5 | ||
| MediaWiki | 1.6.x, 1.8.x, 1.9.x or higher (not tested by author on most recent MW versions - i.e. > 1.12) | ||
| License | MIT | ||
| Download | http://velko.org/mediawiki-extension-add-html-meta-and-title - file attached there - rename it to work | ||
| Example | bulg.dk | ||
|
|||
|
check usage (experimental) |
|||
This extension allows for easier SEO (search engine optimization) with MediaWiki.
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
- Download source from http://velko.org/mediawiki-extension-add-html-meta-and-title - download the attached .phps file and rename it to php, and create a file extensions/Add_HTML_Meta_and_Title.php .
- Enable the extension by adding this line to your LocalSettings.php:
require_once('extensions/Add_HTML_Meta_and_Title.php');
[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.
[edit] See also
- Extension:MetaKeywordsTag for meta tags only
- If you only want to override the title on pages (not append words to it), you might also look at the DISPLAYTITLE tag in combination with the Manual:$wgAllowDisplayTitle and Manual:$wgRestrictDisplayTitle settings.