Extension:Description2/ja

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 does, or perhaps to use it in article lists on the wiki).

Extra options
If you set  in your LocalSettings.php a   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:

You can use the description2 parser function instead to provide a description tag you can control with a template's variables.

アルゴリズム
Description is extracted from the HTML representation of a page:
 * 1) Remove all  elements (and its contents).
 * 2) Find all  elements.
 * 3) Iterate over those paragraphs,  and trimming whitespace around it.
 * 4) The first non-empty paragraph (after all previous transformation) is picked as the description.

Things to consider:


 * When using templates at the top of the articles, if you use instead of tables for the template, be sure it doesn't render paragraphs, which otherwise will be used as the description. This may happen if you have several  inside the template with newlines.

関連項目

 * Extension:OpenGraphMeta – uses Description2's description information when installed.
 * Extension:ExplicitDescription
 * Extension:MetaDescriptionTag
 * Extension:Semantic Meta Tags