Extension:WikiSEO

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

Release status:Extension status stable

ImplementationTemplate:Extension#type Parser function
DescriptionTemplate:Extension#description Allows to change the title and the meta keyword/description tags.
Author(s)Template:Extension#username Andru Vallance (Andrujhontalk)
Latest versionTemplate:Extension#version 1.2.1 (2014-12-11)
MediaWikiTemplate:Extension#mediawiki 1.20+
PHPTemplate:Extension#php 5.3+
Database changesTemplate:Extension#needs-updatephp No
ComposerComposer tinymighty/wiki-seo
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
README
TagsTemplate:Extension#tags
* <seo></seo>
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit
BeforePageDisplayManual:Hooks/BeforePageDisplay
OutputPageBeforeHTMLManual:Hooks/OutputPageBeforeHTML

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

Check usage and version matrix.

The WikiSEO extension allows you to replace, append or prepend the html title tag content, and allows you to add meta keywords and a meta description.

Installation[edit]

Automated Installation with Composer[edit]

This is possible starting with MediaWiki 1.22 and later. Follow the instructions at the Composer help page to add the package tinymighty/wiki-seo to your composer.json file.

Manual Installation[edit]

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

To users running MediaWiki 1.24 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.24 and earlier), instead of wfLoadExtension( 'WikiSEO' );, you need to use:

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

Note Note: If you are installing the extension via a Git clone, be sure to specify the directory name as WikiSEO:

git clone https://github.com/tinymighty/wiki-seo.git WikiSEO

Usage[edit]

The extension can be used via the <seo> tag or the {{#seo}} parser function. Both accept the following named parameters in any order.

tags for general use
  • title
The title you want to appear in the html title tag
  • titlemode
Set to append, prepend, or replace (default) to define how the title will be amended.
  • titleseparator
The separator in case titlemode was set to append or prepend; "-" (default)
  • keywords
A comma separated list of keywords for the meta keywords tag
  • description
A text description for the meta description tag
  • google-site-verification
The Google site verification tag used by Google Webmaster Tools
Note Note: This only needs to be added to your wiki's home page. This is the page that your server returns when someone requests your site (such as e.g. http://www.example.com/wiki/)[1][2]
tags related to the Open Graph protocol[3][4]
  • og:type
The type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required.
  • og:image
An image URL which should represent your object within the graph.
  • og:site_name
If your object is part of a larger web site, the name which should be displayed for the overall site. e.g., "IMDb".
  • og:locale
The locale these tags are marked up in. Of the format language_TERRITORY. Default is en_US.
tags related to Open Graph type "article" [5]
  • article:author
  • article:publisher
  • article:tag
  • article:section
tags related to Facebook Insights[6]
  • fb:admins
  • fb:app_id
tags related to Twitter Cards[7]
  • twitter:card
  • twitter:site
  • twitter:domain
  • twitter:creator
  • twitter:image:src
  • twitter:description

Examples[edit]

Adding static values[edit]

{{#seo:
|title=Your page title
|titlemode=append
|keywords=these,are,your,keywords
|description=Your meta description
}}

or

<seo title="Your page title" titlemode="append" keywords="these,are,your,keywords"  description="Your meta description"></seo>

Adding dynamic values[edit]

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 Semantic MediaWiki and Semantic Forms for data entry, or for programatic creation of a page title from existing variables or content...

{{#seo:
 |title={{#if: {{{page_title|}}} | {{{page_title}}} | Welcome to WikiSEO}}
 |titlemode={{{title_mode|}}}
 |keywords={{{keywords|}}}
 |description={{{description|}}}
 }}

See also[edit]

This extension has been rewritten to current MediaWiki standards based on the Add HTML Meta and Title extension by Vladimir Radulovski. As I have also made some design changes, I have released it as a separate extension, but it is backwards compatible (it provides a <seo> tag, and permits the use of the metakeywords, metak, metadescription and metad attributes.

Notes[edit]