Jump to content

Руководство:Карта сайта

From mediawiki.org
This page is a translated version of the page Manual:Sitemap and the translation is 25% complete.
Outdated translations are marked like this.

Карты сайта это файлы, которые позволяют поисковым роботам (таким как googlebot) более эффективно сканировать веб-сайт (при условии, что бот поддерживает протокол sitemap).

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.