Extension:Description2

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
Description2

Release status:Extension status stable

ImplementationTemplate:Extension#type Data extraction, Parser extension
DescriptionTemplate:Extension#description Provides a meta description tag and adds data to parser output for other extensions to use.
Author(s)Template:Extension#username Daniel Friesen (Dantmantalk)
Latest versionTemplate:Extension#version 0.4.0 (2017-06-08)
Compatibility policyCompatibility#mediawiki_extensions master
MediaWikiTemplate:Extension#mediawiki 1.25+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
Hooks usedTemplate:Extension#hook
ParserAfterTidyManual:Hooks/ParserAfterTidy
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
BeforePageDisplayManual:Hooks/BeforePageDisplay

Translate the Description2 extension if it is available at translatewiki.net

Check usage and version matrix.

The Description2 extension adds a description meta tag for articles automatically based on the content. This functionality appears to have been removed from MediaWiki at some point. There are some situations where description extraction (by entities less sophisticated than Google, like Facebook) will extract the wrong description information from the wiki and use something like the sitenotice as the description for a page instead of its content. This extension also adds the description to the parser output in a way that other extensions can make use of (to say provide description in a different format like Extension:OpenGraphMeta does, or perhaps to use it in article lists on the wiki).

Installation[edit]

  • Download and place the file(s) in a directory called Description2 in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'Description2' );
    
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.29 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.29 and earlier), instead of wfLoadExtension( 'Description2' );, you need to use:

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

Extra options[edit]

If you set $wgEnableMetaDescriptionFunctions = true; in your LocalSettings.php a <metadesc> tag and a {{description2:}} parser function can be used to control the description outputted for the page and override it with a custom one. You can use these parser extensions like so:

<metadesc>This is a description</metadesc>
<metadesc content="This is a description" />
{{#description2:This is a description}}

They all do the same thing, <metadesc> is supported so that Description2 can be used as a replacement for Extension:MetaDescriptionTag. The content="" feature was an extra added since it didn't take much to add and was described that way on Extension:MetaDescriptionTag's documentation page even though it appears merely to be a mistake in the examples. You can use the description2 parser function instead of using #tag to provide a description tag you can control with a template's variables.

See also[edit]