Manual:robots.txt/pl

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

Pliki robots.txt są częścią Standardu Wykluczeń Robotów i może pomóc z Search engine optimization . Informują pająki sieciowe jak mają indeksować stronę. Ten plik musi znajdować się w katalogu głównym domeny.

Przykłady

Żaden nie może indeksować

Ten kod blokuje wszystkim botom indeksowanie wszystkich podstron Twojej witryny:

User-agent: *
Disallow: /

Jeżeli chcesz zablokować konkretne roboty, zamiast gwiazdki wpisz jego nazwę user agent.

Zapobieganie indeksowaniu stron niebędących artykułami

MediaWiki generuje wiele stron będących użyteczne tylko dla ludzi: poprzednie wersje i różnice między nimi powodują duplikowanie znajdywanej zawartości w artykułach. Strony edycji i większość stron specjalnych są dynamicznie generowane i nadające się tylko do użytku przez redagujących, a ich generowanie zużywa zasoby serwera. Jeżeli nie zostanie ustawione inaczej, roboty sieciowe mogą próbować indeksować tysiące podobnych stron, obciążając serwer.

Z krótkimi URL

Można łatwo zapobiec indeksowaniu stron niebędących artykułami jeżeli używasz stylu Wikipedii dla krótkich URL. Zakładając, że artykuły są dostępne poprzez adres /wiki/Jakiś_tytuł, a wszystko inne jest dostępne poprzez $query:

User-agent: *
Disallow: /w/

Bądź ostrożny! Jeżeli przez pomyłkę dasz taką linię:

Disallow: /w

to zablokujesz także katalog /wiki i wyszukiwarki całkowicie porzucą Twoją wiki!

Be aware that this solution will also cause CSS, JavaScript, and image files to be blocked, so search engines like Google will not be able to render previews of wiki articles. To work around this, instead of blocking the entire /w directory, only index.php need be blocked:

User-agent: *
Disallow: /w/index.php?

This works because CSS and JavaScript is retrieved via /w/load.php. Alternatively you could do it as it is done on the Wikimedia farm:

User-agent: *
Allow: /w/load.php?
Disallow: /w/

Bez krótkich URL

Jeżeli nie korzystasz z krótkich URL, ograniczanie robotów jest o wiele trudniejsze. Jeżeli masz uruchomione PHP jako CGI i nie masz przyjaznych URL, to artykuły są dostępne poprzez /index.php?title=Some_title:

User-agent: *
Disallow: /index.php?diff=
Disallow: /index.php?oldid=
Disallow: /index.php?title=Help
Disallow: /index.php?title=Image
Disallow: /index.php?title=MediaWiki
Disallow: /index.php?title=Special:
Disallow: /index.php?title=Template
Disallow: /skins/

If you are running PHP as an Apache module and you have not beautified URLs, so that articles are accessible through /index.php/Some_title:

User-agent: *
Disallow: /index.php?
Disallow: /index.php/Help
Disallow: /index.php/MediaWiki
Disallow: /index.php/Special:
Disallow: /index.php/Template
Disallow: /skins/

The lines without the colons (:) at the end restrict those namespaces' talk pages.

Non-English wikis may need to add various translations of the above lines.

You may wish to omit the /skins/ restriction, as this will prevent images belonging to the skin from being accessed. Search engines which render preview images, such as Google, will show articles with missing images if they cannot access the /skins/ directory.

You can also try

Disallow: /*&

because some robots like Googlebot accept this wildcard extension to the robots.txt standard, which stops most of what we don't want robots sifting through, just like the /w/ solution above. This does, however, suffer from the same limitations in that it blocks access to CSS, preventing search engines from correctly rendering preview images. It may be possible to solve this by adding another line, Allow: /load.php however at the time of writing this is untested.

Allow indexing of raw pages by the Internet Archiver

You may wish to allow the Internet Archiver to index raw pages so that the raw wikitext of pages will be on permanent record. This way, it will be easier, in the event the wiki goes down, for people to put the content on another wiki. You would use:

# Allow the Internet Archiver to index action=raw and thereby store the raw wikitext of pages
User-agent: ia_archiver
Allow: /*&action=raw

Problemy

Rate control

You can only specify what paths a bot is allowed to spider. Even allowing just the plain page area can be a huge burden when two or three pages per second are being requested by one spider over two hundred thousand pages.

Some bots have a custom specification for this; Inktomi responds to a "Crawl-delay" line, which can specify the minimum delay in seconds between hits. (Their default is 15 seconds.)

Złe boty

Sometimes a custom-written bot isn't very smart or is outright malicious and doesn't obey robots.txt at all (or obeys the path restrictions, but spiders very fast, bogging down the site). It may be necessary to block specific user-agent strings or individual IPs of offenders.

More generally, request throttling can stop such bots without requiring your repeated intervention.

An alternative or complementary strategy is to deploy a spider trap.

Spidering vs. indexing

While robots.txt stops (non-evil) bots from downloading the URL, it does not stop them from indexing it. This means that they might still show up in the results of Google and other search engines, as long as there are external links pointing to them. (What's worse, since the bots do not download such pages, noindex meta tags placed in them will have no effect.) For single wiki pages, the __NOINDEX__ magic word might be a more reliable option for keeping them out of search results.