Jump to content

Manual:نقشۀ سایت

From mediawiki.org
This page is a translated version of the page Manual:Sitemap and the translation is 12% complete.

Sitemaps are files that make it more efficient for search engine robots (like googlebot) to crawl a website (so long as the bot supports the sitemap protocol).

MediaWiki supports at least three methods of generating sitemap files.

  • REST API
  • generateSitemap.php maintenance script
  • Sitemap extensions

REST API

Starting with version 1.45, MediaWiki provides a REST API to generate a sitemap on demand.

Enabling REST API Sitemaps

Add the following line to LocalSettings.php to enable the Rest sitemap:

$wgSitemapApiConfig['enabled'] = true;

Add to robots.txt

Sitemap https://example.com/w/rest.php/site/v1/sitemap/0

Note that the REST API can draw the attention of bots, degrading site performance. The WMF has restricted access to the sitemap on all of its projects.

generateSitemap.php

If you choose not use the new REST API, then generateSitemap.php can be used as a maintenance script to generate sitemap files.

Add to robots.txt

Sitemap https://example.com/sitemap/NameOfSitemapIndexFile

Sitemap extensions

Sitemap extensions are also available.