2017.
10.
21
07:27:38
結論から書くと
■やり方その1
(1)複数のsitemap.xmlを設置する
(2)設置した複数のsitemap.xmlの場所をrobots.txtに記述する
■やり方その2
(1)複数のsitemap.xmlを設置する
(2)sitemap.xmlのsitemap.xml(sitemap_index.xml)を設置する
(3)sitemap_index.xmlの場所をrobots.txtに記述する
の2つのやり方があるようです。
それでは詳細を書いていきます。
「やり方その1」は単純ですね。
例えば「sitemap.xml」と「sitemap2.xml」を
「http://example.com」直下に置いたとしましょう。
robots.txtには
と書きます。
これだけです。
「やり方その2」は少しだけ手順が増えます。
例えば「sitemap.xml」と「sitemap2.xml」を
「http://example.com」直下に置いたとしましょう。
sitemap.xmlのsitemap.xmlを設置します。
今回は「sitemap_index.xml」という名前にしますね。
「sitemap_index.xml」の中にはsitemap.xmlを記述します。
例えば、以下のような内容です。
基本的にはsitemap.xmlと同じ書き方ですが「sitemapindex」タグで囲んでいるのと
「url」タグが「sitemap」タグになっているのが特徴です。
あとは「sitemap_index.xml」の場所をrobots.txtに記述します。
のような内容になります。
これで終わりです。
個人的には「やり方その1」でも良いと思うのですが、
一般的には「やり方その2」が推奨されているっぽいです。
「どちらでもOK!」な人は「やり方その2」にしておいた方が無難なのではないでしょうか。
とりあえず、そんな感じ\(--)/
■やり方その1
(1)複数のsitemap.xmlを設置する
(2)設置した複数のsitemap.xmlの場所をrobots.txtに記述する
■やり方その2
(1)複数のsitemap.xmlを設置する
(2)sitemap.xmlのsitemap.xml(sitemap_index.xml)を設置する
(3)sitemap_index.xmlの場所をrobots.txtに記述する
の2つのやり方があるようです。
それでは詳細を書いていきます。
「やり方その1」は単純ですね。
例えば「sitemap.xml」と「sitemap2.xml」を
「http://example.com」直下に置いたとしましょう。
robots.txtには
User-agent: *
Sitemap: http://example.com/sitemap.xml
Sitemap: http://example.com/sitemap2.xml
Sitemap: http://example.com/sitemap.xml
Sitemap: http://example.com/sitemap2.xml
と書きます。
これだけです。
「やり方その2」は少しだけ手順が増えます。
例えば「sitemap.xml」と「sitemap2.xml」を
「http://example.com」直下に置いたとしましょう。
sitemap.xmlのsitemap.xmlを設置します。
今回は「sitemap_index.xml」という名前にしますね。
「sitemap_index.xml」の中にはsitemap.xmlを記述します。
例えば、以下のような内容です。
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://example.com/sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>http://example.com/sitemap2.xml</loc>
</sitemap>
</sitemapindex>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>http://example.com/sitemap.xml</loc>
</sitemap>
<sitemap>
<loc>http://example.com/sitemap2.xml</loc>
</sitemap>
</sitemapindex>
基本的にはsitemap.xmlと同じ書き方ですが「sitemapindex」タグで囲んでいるのと
「url」タグが「sitemap」タグになっているのが特徴です。
あとは「sitemap_index.xml」の場所をrobots.txtに記述します。
User-agent: *
Sitemap: http://example.com/sitemap_index.xml
Sitemap: http://example.com/sitemap_index.xml
のような内容になります。
これで終わりです。
個人的には「やり方その1」でも良いと思うのですが、
一般的には「やり方その2」が推奨されているっぽいです。
「どちらでもOK!」な人は「やり方その2」にしておいた方が無難なのではないでしょうか。
とりあえず、そんな感じ\(--)/