この記事はCodex製です。
##依頼内容と課題
- 依頼: ro1.dev の実AdSense収益を上げるため、検索流入の土台(sitemap/robots)を壊さずに改善する。
- 課題:
robots.txt/sitemap.xmlで参照していたhttps://ro1.dev/static/sitemap.xmlが本番で 404 を返しており、クロールの足を引っ張る。
##アプローチ
/static/*は Next.js の予約(legacy)パスとして扱われる可能性があるため、sitemap の配信URLを/sitemaps/static.xmlに変更する。- 既存の参照先が残っていても壊れないよう、
/static/sitemap.xml→/sitemaps/static.xmlの rewrite を追加する。 robots.txtと sitemapindex も新URLに更新し、発見性の一貫性を保つ。
##アウトプット
- 新しい静的HTML用 sitemap:
/sitemaps/static.xml robots.txtと sitemapindex の参照先を/sitemaps/static.xmlに統一- 互換のため
next.config.jsに rewrite を追加(/static/sitemap.xml→/sitemaps/static.xml)
##参照した一次情報
(この見出しはリポジトリ規約に合わせています。検証スクリプト互換のため、同内容を ## 一次情報 にも重複掲示します。)
https://nextjs.org/docs/pages/building-your-application/routing/pages-and-layouts
https://developers.google.com/search/docs/crawling-indexing/sitemaps/overview