Module:SEO/doc: Difference between revisions

From NOISZ Wiki
(Created page with "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 Optimisation) meta elements such as "keywords" and "description". == Usage == <!--T:3--> <!--T:28--> The extension can be used via the <code><nowiki>{{#seo}}</nowiki></code> parser function or in Lua modules by using <code>mw.ext.seo.set()</code>. <!--T:22--> It accepts the following named parameters in any order. ===Paramete...")
 
No edit summary
 
Line 1: Line 1:
For full documentation, see [https://www.mediawiki.org/wiki/Extension:WikiSEO the extension page].
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 Optimisation) meta elements such as "keywords" and "description".  
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 Optimisation) meta elements such as "keywords" and "description".  



Latest revision as of 15:43, 4 December 2025

For full documentation, see the extension page.

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 Optimisation) meta elements such as "keywords" and "description".

Usage

The extension can be used via the {{#seo}} parser function or in Lua modules by using mw.ext.seo.set().
It accepts the following named parameters in any order.


Parameters supported by all generators

Name Default Description Example
title (empty) The title you want to appear in the html title tag. Will also be used for OpenGraph, Schema.org and Twitter metadata.
{{#seo:|title=This is the title of the page}}
title_mode replace Set to append, prepend, or replace (default) to define how the title will be amended. Further examples can be found here.
{{#seo:|title=This replaces the Title of the Page|title_mode=replace}}
title_separator - The separator in case title_mode was set to append or prepend.
{{#seo:|title=This gets prepended to the page name separated by the separator|title_mode=prepend|title_separator=<<}}
keywords (empty) A comma separated list of keywords describing the page content. Will also be used for OpenGraph, Schema.org and Twitter metadata.
{{#seo:|keywords=Apple, Pears, Oranges}}
description (empty) A short text describing the page topic. Will also be used for OpenGraph, Schema.org and Twitter metadata.
{{#seo:|description=This page contains information about...}}

Examples

Adding static values

{{#seo:
|title=Your page title
|title_mode=append
|keywords=these,are,your,keywords
|description=Your meta description
|image=Uploaded_file.png
|image_alt=Wiki Logo
}}


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...
{{#seo:
 |title={{#if: {{{page_title|}}} | {{{page_title}}} | Welcome to WikiSEO}}
 |title_mode={{{title_mode|}}}
 |keywords={{{keywords|}}}
 |description={{{description|}}}
 |published_time={{REVISIONYEAR}}-{{REVISIONMONTH}}-{{REVISIONDAY2}}
}}
{{#seo:
 |title_mode=append
 |title=Example SEO Wiki
 |keywords=WikiSEO, SEO, MediaWiki
 |description=An example description for this wiki
 |image=Wiki_Logo.png
 |image_alt=Wiki Logo
 |site_name=Example SEO Wiki
 |locale=en_EN
 |type=website
 |modified_time={{REVISIONYEAR}}-{{REVISIONMONTH}}-{{REVISIONDAY2}}
 |published_time=2020-11-01
}}


Hreflang Attributes

{{#seo:
 |hreflang_de-de=https://example.de/page
 |hreflang_nl-nl=https://example.nl/page-nl
 |hreflang_en-us=https://website.com/
}}
Will generate the following tag elements:

<link rel="alternate" href="https://example.de/page" hreflang="de-de"> <link rel="alternate" href="https://example.nl/page-nl" hreflang="nl-nl"> <link rel="alternate" href="https://website.com/" hreflang="en-us">


Title Modes

Example: Page with title Example Page


Append

{{#seo:
 |title_mode=append
 |title=Appended Title
}}
HTML Title result:

Example Page - Appended Title

Prepend

{{#seo:
 |title_mode=prepend
 |title=Prepended Title
}}
HTML Title result:

Prepended Title - Example Page


Prepend (changed separator)

{{#seo:
 |title_mode=prepend
 |title=Prepended Title
 |title_separator= >> 
}}
HTML Title result:

Prepended Title >> Example Page


Replace (default)

{{#seo:
 |title_mode=replace
 |title=Replaced Title
}}
HTML Title result:

Replaced Title