タイトル: サイトマップとRSS/Atom
SEOタイトル: サイトマップ XML と RSS/Atom 完全ガイド
この本文には実行可能なタグ等が含まれるため、安全のためHTMLソースとして表示しています。本文データは変更していません。
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;background:#fffbea;border:1px solid #f4c430;margin:1em 0;width:100%"><tr><td style="background:#f4c430;color:#000;font-weight:bold;padding:8px">この記事の要点</td></tr><tr><td style="padding:10px"><ul><li><strong>sitemap.xml</strong>: 検索エンジンに「このサイトにあるページ一覧」を伝えるための XML</li><li><strong>RSS / Atom</strong>: ブログ等の<strong>新着記事フィード</strong>を機械可読で配信するための XML</li><li>sitemap は <strong>SEO 用 (クロール最適化)</strong>、RSS/Atom は <strong>購読者用 (Feedly 等)</strong></li><li>Google Search Console に sitemap を送信して<strong>インデックス促進</strong></li><li><strong>robots.txt</strong> の末尾に <code>Sitemap: https://example.com/sitemap.xml</code> を書くのが慣例</li></ul></td></tr></table>
<h2>サイトマップ XML (sitemap.xml)</h2>
<p>sitemap.xml は、検索エンジン (Google / Bing) に「このサイトには次の URL がある」と知らせる<strong>クロール用のインデックスファイル</strong>です。SEO 観点で必須に近い存在。</p>
<h3>最小構成</h3>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-xml"><?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></code></pre>
<h3>各タグの意味</h3>
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;width:100%">
<thead><tr style="background:#e3f2fd"><th>タグ</th><th>必須</th><th>意味</th></tr></thead>
<tbody>
<tr><td><code><loc></code></td><td>○</td><td>URL (絶対パス)</td></tr>
<tr><td><code><lastmod></code></td><td>×</td><td>最終更新日 (ISO 8601: YYYY-MM-DD)</td></tr>
<tr><td><code><changefreq></code></td><td>×</td><td>更新頻度の目安 (always/hourly/daily/weekly/monthly/yearly/never)</td></tr>
<tr><td><code><priority></code></td><td>×</td><td>サイト内重要度 0.0-1.0 (デフォルト 0.5)</td></tr>
</tbody>
</table>
<p>※ Google は近年 <code>changefreq</code> と <code>priority</code> をほぼ無視。<code>lastmod</code> のみ重視。</p>
<h2>制限とサイトマップインデックス</h2>
<ul>
<li>1 sitemap.xml は<strong>最大 50,000 URL / 50MB (非圧縮)</strong></li>
<li>超える場合は<strong>サイトマップインデックス</strong>で分割</li>
</ul>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-xml"><!-- 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></code></pre>
<h2>画像 / 動画 / ニュース sitemap</h2>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-xml"><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></code></pre>
<h2>robots.txt との連携</h2>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-text"># robots.txt
User-agent: *
Allow: /
Sitemap: https://example.com/sitemap.xml
Sitemap: https://example.com/sitemap-images.xml</code></pre>
<h2>Google Search Console への送信</h2>
<ol>
<li><a href="https://search.google.com/search-console">Search Console</a> でプロパティ登録 (DNS / HTML タグ認証)</li>
<li>左メニュー → <strong>サイトマップ</strong></li>
<li>「<code>sitemap.xml</code>」と入力して送信</li>
<li>1-数日でステータスが「成功」に</li>
<li>「カバレッジ」レポートでインデックス状況確認</li>
</ol>
<h2>RSS 2.0 と Atom 1.0</h2>
<p>RSS / Atom は<strong>新着記事フィード</strong>を機械可読で配信する XML 形式。読者は Feedly / Inoreader 等の RSS リーダーで購読します。</p>
<h3>RSS 2.0</h3>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-xml"><?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></code></pre>
<h3>Atom 1.0</h3>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-xml"><?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></code></pre>
<h2>RSS と Atom の違い</h2>
<table border="1" cellpadding="6" cellspacing="0" style="border-collapse:collapse;width:100%">
<thead><tr style="background:#e3f2fd"><th>項目</th><th>RSS 2.0</th><th>Atom 1.0</th></tr></thead>
<tbody>
<tr><td>策定団体</td><td>Harvard (UserLand)</td><td>IETF (RFC 4287)</td></tr>
<tr><td>日付形式</td><td>RFC 822 (英語曜日)</td><td>ISO 8601</td></tr>
<tr><td>コンテンツ型指定</td><td>×</td><td>○ (<code>type="html"</code> 等)</td></tr>
<tr><td>仕様の厳密性</td><td>緩い</td><td>厳密</td></tr>
<tr><td>普及度</td><td>古い CMS 中心</td><td>新しいシステム中心</td></tr>
</tbody>
</table>
<h2>HTML から自動検出させる</h2>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-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></code></pre>
<h2>自動生成 (Laravel / WordPress)</h2>
<h3>WordPress</h3>
<ul>
<li>RSS フィードは標準で <code>https://example.com/feed/</code> に自動生成</li>
<li>sitemap は WordPress 5.5 以降コアに同梱: <code>https://example.com/wp-sitemap.xml</code></li>
<li>プラグイン: <strong>Yoast SEO</strong> / <strong>Rank Math</strong> でカスタマイズ可能</li>
</ul>
<h3>Laravel (例: sitemap)</h3>
<pre style="background:#1e293b;color:#e2e8f0;padding:1em;border-radius:6px;overflow-x:auto;line-height:1.5"><code class="language-php">// 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></code></pre>
<h2>RSS リーダー一覧</h2>
<ul>
<li><strong>Feedly</strong>: Web / モバイル、無料枠あり、シェア NO.1</li>
<li><strong>Inoreader</strong>: 高機能、ルールベース通知、エンタープライズ</li>
<li><strong>The Old Reader</strong>: 軽量、UI シンプル</li>
<li><strong>NetNewsWire</strong>: Apple 純正風、Mac/iOS、無料 OSS</li>
<li><strong>Tiny Tiny RSS</strong>: セルフホスト、PHP</li>
</ul>
<h2>FAQ</h2>
<p><strong>Q: sitemap.xml は必須?</strong><br />
A: 数十ページなら無くてもクロールされますが、数百ページ以上 / SPA / 検索流入を狙うなら<strong>必須</strong>。</p>
<p><strong>Q: RSS は時代遅れ?</strong><br />
A: 一般ユーザの利用は減りましたが、技術者・ニュース愛好者には今も主力。Slack / Discord に RSS Bot で流す用途も多い。</p>
<p><strong>Q: AMP / News サイトマップは?</strong><br />
A: Google News に登録するには <strong>News サイトマップ</strong>が別途必要 (記事の発行時刻精度が重要)。</p>