Extension:AutoSitemap

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

Release status:Extension status stable

ImplementationTemplate:Extension#type MyWiki, Page action
DescriptionTemplate:Extension#description Creates and updates a Sitemap file automatically while any site`s page is changing.
Author(s)Template:Extension#username Dolfinus, François Boutines-Vignard, Jehy, Thomas
Latest versionTemplate:Extension#version 1.2 (2017-02-04)
MediaWikiTemplate:Extension#mediawiki 1.25+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 3.0 or later
Download Download snapshot
README
ExampleTemplate:Extension#example Generated sitemap
ParametersTemplate:Extension#parameters

$wgAutoSitemap

Hooks usedTemplate:Extension#hook
PageContentInsertCompleteManual:Hooks/PageContentInsertComplete
AfterImportPageManual:Hooks/AfterImportPage
ArticleDeleteCompleteManual:Hooks/ArticleDeleteComplete
ArticleUndeleteManual:Hooks/ArticleUndelete
TitleMoveCompleteManual:Hooks/TitleMoveComplete
ArticleMergeCompleteManual:Hooks/ArticleMergeComplete
ArticleRollbackCompleteManual:Hooks/ArticleRollbackComplete
UploadCompleteManual:Hooks/UploadComplete
ArticleRevisionUndeletedManual:Hooks/ArticleRevisionUndeleted
RevisionInsertCompleteManual:Hooks/RevisionInsertComplete
PageContentSaveCompleteManual:Hooks/PageContentSaveComplete

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

Check usage and version matrix.

Disclaimer[edit source]

This extension is based on extension Extension:ManualSitemap. I haven`t possibility for updating my sitemap via cron because of hosting provider, and I also doesn`t want to update it manually. So I edited an exist extension to update sitemap by itself at any page edit, create, delete, rename, upload, etc events.

Description[edit source]

AutoSitemap is MediaWiki extension that automatically build sitemap.xml file at every page create/edit/delete event. Sitemap file helps search engines to observe your site’s pages

Intall[edit source]

Download the latest snapshot and extract it to your extensions directory. Then include it in your LocalSettings.php file as in the following example:

wfLoadExtension( 'AutoSitemap' );

Configure[edit source]

There are some optional parameters that changes the sitemap generation. You can set them in your LocalSettings.php.

Filename[edit source]

You can set filename of sitemap by setting:

$wgAutoSitemap["filename"] = "sitemap.xml"; //default value

Setting base url[edit source]

By default all urls in sitemap use $wgCanonicalServer (or $wgServer, if it doesn’t set) as domain prefix. If you want to set it to another one, you can change it manually by setting:

$wgAutoSitemap["server"] = "https://your-site.com";

Search engines notification[edit source]

You can notify web sites you want about the update of sitemap. Just write all notify urls as array:

$wgAutoSitemap["notify"] = [
    'https://www.google.com/webmasters/sitemaps/ping?sitemap=https://your-site.com/sitemap.xml',
    'https://www.bing.com/webmaster/ping.aspx?sitemap=https://your-site.com/sitemap.xml',
    'https://blogs.yandex.ru/pings/?status=success&url=https://your-site.com/sitemap.xml',
];

Sometimes web hoster does not allow the fopen command to call urls (allow_url_fopen=false). If you can’t or doesn’t want to use notification, set this to empty array by deleting all lines between brackets (= [];).

Exclude types of pages from sitemap[edit source]

You can exclude namespaces or exact pages from including them to sitemap:

$wgAutoSitemap["exclude_namespaces"] = [
    NS_TALK,
    NS_USER,   
    NS_USER_TALK,
    NS_PROJECT_TALK,
    NS_IMAGE_TALK,
    NS_MEDIAWIKI,   
    NS_MEDIAWIKI_TALK,
    NS_TEMPLATE,
    NS_TEMPLATE_TALK,
    NS_HELP,   
    NS_HELP_TALK,
    NS_CATEGORY_TALK
]; //default values

$wgAutoSitemap["exclude_pages"] = ['page title to exclude', 'other one'];

Set page update frequency[edit source]

You can manually specify the recommended frequency with which all addresses will be checked by search engine:

$wgAutoSitemap["freq"] = "daily"; //default

Available values are:

hourly
daily
weekly
monthly
yearly
adjust - for automatic determination of frequency based on page edits count

Use[edit source]

Permissions[edit source]

Your MediaWiki folder should be permitted for write operations (chmod +w with chown apache or chown nginx).

Htaccess, Nginx[edit source]

If you want to see a human-readable sitemap, allow read access for sitemap.xsl file in your site config (.htacces file or other).

See also[edit source]