5.

サイトマップ XML と RSS/Atom 完全ガイド

編集
この記事の要点
  • sitemap.xml: 検索エンジンに「このサイトにあるページ一覧」を伝えるための XML
  • RSS / Atom: ブログ等の新着記事フィードを機械可読で配信するための XML
  • sitemap は SEO 用 (クロール最適化)、RSS/Atom は 購読者用 (Feedly 等)
  • Google Search Console に sitemap を送信してインデックス促進
  • robots.txt の末尾に Sitemap: https://example.com/sitemap.xml を書くのが慣例

サイトマップ XML (sitemap.xml)

sitemap.xml は、検索エンジン (Google / Bing) に「このサイトには次の URL がある」と知らせるクロール用のインデックスファイルです。SEO 観点で必須に近い存在。

最小構成

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/</loc>
    <lastmod>2026-06-10</lastmod>
    <changefreq>weekly</changefreq>
    <priority>1.0</priority>
  </url>
  <url>
    <loc>https://example.com/about</loc>
    <lastmod>2026-05-15</lastmod>
    <changefreq>monthly</changefreq>
    <priority>0.5</priority>
  </url>
</urlset>

各タグの意味

タグ必須意味
<loc>URL (絶対パス)
<lastmod>×最終更新日 (ISO 8601: YYYY-MM-DD)
<changefreq>×更新頻度の目安 (always/hourly/daily/weekly/monthly/yearly/never)
<priority>×サイト内重要度 0.0-1.0 (デフォルト 0.5)

※ Google は近年 changefreqpriority をほぼ無視。lastmod のみ重視。

制限とサイトマップインデックス

  • 1 sitemap.xml は最大 50,000 URL / 50MB (非圧縮)
  • 超える場合はサイトマップインデックスで分割
<!-- sitemap-index.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
    <loc>https://example.com/sitemap-posts.xml</loc>
    <lastmod>2026-06-10</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-pages.xml</loc>
    <lastmod>2026-05-15</lastmod>
  </sitemap>
  <sitemap>
    <loc>https://example.com/sitemap-images.xml</loc>
    <lastmod>2026-05-15</lastmod>
  </sitemap>
</sitemapindex>

画像 / 動画 / ニュース sitemap

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
        xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
  <url>
    <loc>https://example.com/article/1</loc>
    <image:image>
      <image:loc>https://example.com/img/1.jpg</image:loc>
      <image:title>記事のメイン画像</image:title>
    </image:image>
    <video:video>
      <video:thumbnail_loc>https://example.com/thumb/1.jpg</video:thumbnail_loc>
      <video:title>動画タイトル</video:title>
      <video:description>説明</video:description>
      <video:content_loc>https://example.com/video/1.mp4</video:content_loc>
    </video:video>
  </url>
</urlset>

robots.txt との連携

# robots.txt
User-agent: *
Allow: /

Sitemap: https://example.com/sitemap.xml
Sitemap: https://example.com/sitemap-images.xml

Google Search Console への送信

  1. Search Console でプロパティ登録 (DNS / HTML タグ認証)
  2. 左メニュー → サイトマップ
  3. sitemap.xml」と入力して送信
  4. 1-数日でステータスが「成功」に
  5. 「カバレッジ」レポートでインデックス状況確認

RSS 2.0 と Atom 1.0

RSS / Atom は新着記事フィードを機械可読で配信する XML 形式。読者は Feedly / Inoreader 等の RSS リーダーで購読します。

RSS 2.0

<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>サンプルブログ</title>
    <link>https://example.com/</link>
    <description>技術記事の更新情報</description>
    <language>ja</language>
    <pubDate>Wed, 10 Jun 2026 12:00:00 +0900</pubDate>

    <item>
      <title>CSS セレクタ完全ガイド</title>
      <link>https://example.com/posts/css-selectors</link>
      <description>CSS セレクタの基本から疑似クラスまで</description>
      <pubDate>Wed, 10 Jun 2026 10:00:00 +0900</pubDate>
      <guid>https://example.com/posts/css-selectors</guid>
    </item>

    <item>
      <title>HTML title 要素ガイド</title>
      <link>https://example.com/posts/title-element</link>
      <description>SEO 観点での title</description>
      <pubDate>Tue, 09 Jun 2026 10:00:00 +0900</pubDate>
      <guid>https://example.com/posts/title-element</guid>
    </item>
  </channel>
</rss>

Atom 1.0

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>サンプルブログ</title>
  <link href="https://example.com/" />
  <link href="https://example.com/feed.atom" rel="self" />
  <updated>2026-06-10T12:00:00+09:00</updated>
  <id>https://example.com/</id>
  <author><name>山田 太郎</name></author>

  <entry>
    <title>CSS セレクタ完全ガイド</title>
    <link href="https://example.com/posts/css-selectors" />
    <id>https://example.com/posts/css-selectors</id>
    <updated>2026-06-10T10:00:00+09:00</updated>
    <summary>CSS セレクタの基本から疑似クラスまで</summary>
    <content type="html"><![CDATA[
      <p>本文HTML...</p>
    ]]></content>
  </entry>
</feed>

RSS と Atom の違い

項目RSS 2.0Atom 1.0
策定団体Harvard (UserLand)IETF (RFC 4287)
日付形式RFC 822 (英語曜日)ISO 8601
コンテンツ型指定×○ (type="html" 等)
仕様の厳密性緩い厳密
普及度古い CMS 中心新しいシステム中心

HTML から自動検出させる

<head>
  <link rel="alternate" type="application/rss+xml" title="サンプルブログ RSS"
        href="https://example.com/rss.xml">
  <link rel="alternate" type="application/atom+xml" title="サンプルブログ Atom"
        href="https://example.com/feed.atom">
</head>

自動生成 (Laravel / WordPress)

WordPress

  • RSS フィードは標準で https://example.com/feed/ に自動生成
  • sitemap は WordPress 5.5 以降コアに同梱: https://example.com/wp-sitemap.xml
  • プラグイン: Yoast SEO / Rank Math でカスタマイズ可能

Laravel (例: sitemap)

// routes/web.php
Route::get('/sitemap.xml', function () {
    $urls = Post::where('published', 1)->get();
    return response()->view('sitemap', compact('urls'))
        ->header('Content-Type', 'application/xml');
});

// resources/views/sitemap.blade.php
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@foreach ($urls as $url)
  <url>
    <loc>{{ url("/posts/{$url->slug}") }}</loc>
    <lastmod>{{ $url->updated_at->toDateString() }}</lastmod>
  </url>
@endforeach
</urlset>

RSS リーダー一覧

  • Feedly: Web / モバイル、無料枠あり、シェア NO.1
  • Inoreader: 高機能、ルールベース通知、エンタープライズ
  • The Old Reader: 軽量、UI シンプル
  • NetNewsWire: Apple 純正風、Mac/iOS、無料 OSS
  • Tiny Tiny RSS: セルフホスト、PHP

FAQ

Q: sitemap.xml は必須?
A: 数十ページなら無くてもクロールされますが、数百ページ以上 / SPA / 検索流入を狙うなら必須

Q: RSS は時代遅れ?
A: 一般ユーザの利用は減りましたが、技術者・ニュース愛好者には今も主力。Slack / Discord に RSS Bot で流す用途も多い。

Q: AMP / News サイトマップは?
A: Google News に登録するには News サイトマップが別途必要 (記事の発行時刻精度が重要)。

編集
Post Share
子ページ

子ページはありません

同階層のページ
  1. タイトルにキーワードを盛り込む
  2. SSL化
  3. scriptタグの記載場所
  4. サイトの引越し
  5. サイトマップとRSS/Atom
  6. CSSの遅延読み込み処理
  7. PageSpeed Insights
  8. Google Search Console
  9. Bing Webmaster Tools

最近更新/作成されたページ