Extension:MetaDescriptionTag

The MetaDescriptionTag extension which gives users the ability to inject a  description into the document header.

The code on this page was updated for MediaWiki 1.16+. Another version, updated for 1.18 by Choshi, is available at this revision of this page. The differences appear to be minor.

Installation

 * 1) Create files named   and , containing the code below, respectively.
 * 2) Copy these files to.
 * Note:  is your MediaWiki install directory.
 * 1) Enable the extension by adding this line to your  :

Usage
Once installed, editors of your wiki can add a &lt;meta&gt; description tag by adding the following to the article text: &lt;metadesc&gt; PageDescription &lt;/metadesc&gt; Where  would be replaced by the desired meta description.

For example, the above would become: &lt;meta name="description" content="PageDescription" /&gt;

Example using template, variable substitution
(This approach requires MediaWiki 1.12 - or install Extension:TagParser. Explanation at Manual:Tag_extensions.)

Say for example you want use a template to set the meta description to something like:

Extract from the article ARTICLETITLE

Create a template called (for example) "Template:Metadesc". Add the following content:

In the article to which you set the meta description, add:

MetaDescriptionTag.i18n.php
, um dem Seitenheader eine Beschreibung (description) hinzufügen zu können', 'metadescriptiontag-missing-content' => 'Fehler: Zum Tag &lt;metadesc&gt; muss das Attribut &quot;content&quot; angegeben werden.', );

/** Hebrew (עברית) * @author DrorSnir */ $messages['he'] = array(	'metadescriptiontag-desc' => 'תגית המאפשרת לקבוע את תיאור העמוד עבור מנועי חיפוש (Meta description)',	'metadescriptiontag-missing-content' => 'שגיאה: תגית &lt;metadesc&gt; חייבת לכלול תכונת &lt;metadesc&gt;.', );