Extension:WikiSEO

The WikiSEO extension allows you to replace, append or prepend the HTML title tag content. It also allows you to add common SEO (Search Engine Optimization) meta elements such as "keywords" and "description".

A working job queue is absolutely required for this extension to function.

Usage
The extension can be used via the  parser function or in Lua modules by using. It accepts the following named parameters in any order.

Do note that the Citation generator is not activated by default! To activate the generator add the following snippet to : $wgMetadataGenerators[] = "Citation";

Adding dynamic values
If you need to include variables or templates you should use the parser function to ensure they are properly parsed. This allows you to use Cargo or Semantic MediaWiki, with Page Forms, for data entry, or for programmatic creation of a page title from existing variables or content...

Usage in lua modules
The module would now be callable as  or.

Hreflang Attributes
Will generate the following elements:

Title Modes
Example: Page with title

Append
HTML Title result:

Prepend
HTML Title result:

Prepend (changed separator)
HTML Title result:

Replace (default)
HTML Title result:

Maintenance Script
WikiSEO provides a maintenance script to generate descriptions for specified pages. This script requires Extension:TextExtracts to be installed and active. The script will only generate descriptions for pages that don't have a  property set in the page properties table.

You can force the generation using the  flag, this will overwrite any description already present.

A list of namespace ids needs to be given in order for the script to work: php maintenance/GenerateDescription.php 0
 * 1) Run only in main namespace

php maintenance/GenerateDescription.php --force 0
 * 1) Run only in main namespace and overwrite existing descriptions

php maintenance/GenerateDescription.php --force --cleanSentence 1234
 * 1) Run in namespace 1234, overwrite descriptions and remove dangling sentences

Configuration
The following variables are in use by this extension.

Set a default image to use if no image is set on the site. If this variable is not set the site's logo will be used.

Usage:.

Array containing the metadata generator names to load.

Default:.

If you only want to change the page title and add 'description', 'keywords', 'robots' tags set

Disable setting $wgLogo as a fallback image if no image for a page was set.

Defaults to `summary_large_image` for the twitter card type.

Usage: $wgTwitterCardType = 'summary';

An array of page titles where a 'noindex' robot tag should be added. Usage: $wgWikiSeoNoindexPageTitles = [ 'Custom_Title', 'Main_Page' ];

A default language code with area to generate a  for.

Usage: $wgWikiSeoDefaultLanguage = 'de-de';

If no description was given in the parser function, a short description from Extension:TextExtracts will be requested. A description will only be set, if the page is edited and saved. Alternatively the maintenance script  can be run from the extension folder.

Tries to remove dangling sentences from the description provided by TextExtracts. This will remove the last sentence not ending in a '.', and will result in descriptions shorter than 160 characters.

Removed tags

 * DC.date.created
 * DC.date.issued
 * google
 * name
 * og:title (automatically set)
 * og:url (automatically set)
 * twitter:card (automatically set)
 * twitter:creator
 * twitter:domain
 * article:modified_time / og:updated_time (automatically set)

Removed aliases

 * metakeywords / metak
 * use keywords instead


 * metadescription / metad
 * use description instead


 * titlemode / title mode
 * use title_mode instead

Changed argument names

 * article:author -> author
 * article:section -> section
 * article:tag -> keywords
 * article:published_time -> published_time
 * og:image / twitter:image:src -> image
 * og:image:width -> image_width
 * og:image:height -> image_height
 * og:locale -> locale
 * og:site_name -> site_name
 * og:title -> title
 * og:type -> type
 * twitter:description -> description

Known issues
Extension:PageImages will add an  tag if an image is found on the page. If another image was set using WikiSEO, both  will be added to the page.

Further information:
 * https://phabricator.wikimedia.org/T300587
 * https://github.com/octfx/wiki-seo/issues/32

Setting  disables PageImages setting any   metatags.

Additionally you can set  to overwrite the image set by PageImages with the one specified by WikiSEO.

Further details
This extension is not a drop-in replacement for the previous version of this extension from tinymighty/wiki-seo.

If you only want to override the display 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.

schema.org
The  generator will set a SearchAction property based on Special:Search.

The properties publisher and author will be set to  with the name set to the content of.

will be automatically set by fetching the latest revision timestamp. If no  is set,   will be set to the latest revision timestamp.

OpenGraph
will be automatically set by fetching the latest revision timestamp. If no  is set,   will be set to the latest revision timestamp.

Integration
WikiSEO will use descriptions provided by Extension:Description2.