facebook twitter hatena line email

SEO/sitemap

提供: 初心者エンジニアの簡易メモ
移動: 案内検索

googleのsitemap推奨フォーマット

http://googlewebmastercentral.blogspot.jp/2014/10/best-practices-for-xml-sitemaps-rssatom.html

https://support.google.com/webmasters/answer/183668?hl=en&rd=1

Example of an XML sitemap:

<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
 <url>
   <loc>http://example.com/mypage</loc>
   <lastmod>2011-06-27T19:34:00+01:00</lastmod>
   <changefreq>daily</changefreq>
   <priority>0.5</priority>
 </url>
 <url>
   ...
 </url>
</urlset>

sitemap_changefreqのデータ

  • always:常に
  • hourly:1時間ごと
  • daily:1日ごと
  • weekly:週ごと
  • monthly:月ごと
  • yearly:年ごと
  • never:更新してない

sitemapにimageを追加

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
   xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
   <url>
     <loc>http://example.com/mypage</loc>
     <lastmod>2011-06-27T19:34:00+01:00</lastmod>
     <image:image>
       <image:loc>http://example.com/page.png</image:loc>
       <image:title>画像タイトル</image:title>
       <image:caption>画像の説明文</image:caption>
     </image:image>
   </url>
</urlset>

以下属性を追加しないと解析エラーとなるので注意

xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"

参考ページ

https://support.google.com/webmasters/answer/178636?vid=1-635796708045339419-982841286

http://lblevery.com/sfn/attract/wmt/sitemap-create/

http://www.adminweb.jp/wmt/sitemap/index8.html

sitemapにvideoを追加

<?xml version="1.0" encoding="UTF-8"?>
<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>http://www.example.com/foo.html</loc> 
    <image:image>
       <image:loc>http://example.com/image.jpg</image:loc>
       <image:caption>Dogs playing poker</image:caption>
    </image:image>
    <video:video>
      <video:content_loc>
        http://www.example.com/video123.flv
      </video:content_loc>
      <video:player_loc allow_embed="yes" autoplay="ap=1">
        http://www.example.com/videoplayer.swf?video=123
      </video:player_loc>
      <video:thumbnail_loc>
        http://www.example.com/thumbs/123.jpg
      </video:thumbnail_loc>
      <video:title>Grilling steaks for summer</video:title>  
      <video:description>
        Cook the perfect steak every time.
      </video:description>
    </video:video>
  </url>
</urlset>

参考: https://support.google.com/webmasters/answer/183668?hl=en&rd=1

googleのrss推奨フォーマット

Example of an RSS feed:

参考 http://googlewebmastercentral.blogspot.jp/2014/10/best-practices-for-xml-sitemaps-rssatom.html

dc:dateでなくpubDateを使う

<?xml version="1.0" encoding="utf-8"?>
<rss>
 <channel>
   <item>
     <link>http://example.com/mypage</link>
     <pubDate>Mon, 27 Jun 2011 19:34:00 +0100</pubDate>
   </item>
   <item>
     ...
   </item>
 </channel>
</rss>

Example of an Atom feed:

<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
 <entry>
   <link href="http://example.com/mypage" />
   <updated>2011-06-27T19:34:00+01:00</updated>
 </entry>
 <entry>
   ...
 </entry>
</feed>

モバイル(ガラケー)のみのsitemap記述方法

<?xml version="1.0" encoding="UTF-8" ?>
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0">
    <url>
        <loc>http://mobile.example.com/article100.html</loc>
        <mobile:mobile/>
    </url>
</urlset>

参考ページ

https://support.google.com/webmasters/answer/6082207?vid=1-635796712645620691-982841286

https://support.google.com/webmasters/answer/34648?rd=1

ニュースのみのsitemap記述方法

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
        xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
  <url>
    <loc>http://www.example.org/business/article55.html</loc>
    <news:news>
      <news:publication>
        <news:name>The Example Times</news:name>
        <news:language>en</news:language>
      </news:publication>
      <news:access>Subscription</news:access>
      <news:genres>PressRelease, Blog</news:genres>
      <news:publication_date>2008-12-23</news:publication_date>
      <news:title>Companies A, B in Merger Talks</news:title>
      <news:keywords>business, merger, acquisition, A, B</news:keywords>
      <news:stock_tickers>NASDAQ:A, NASDAQ:B</news:stock_tickers>
    </news:news>
  </url>
</urlset>

参考: https://support.google.com/news/publisher/answer/74288

sitemap登録

サーチコンソールから行う https://www.google.com/webmasters/tools/home?hl=ja

このサイトにはxmlのsitemapと(rss/atom)が登録できるので両方登録しておく(by google両方推奨)

priorityはあまり重要でない

Google社員が言ってる様子。 lastmodを使う。

参考: http://detail-cc.com/seomaster/daily_news/2015/07/17/seo-news-2015%E5%B9%B47%E6%9C%886%E6%97%A5%EF%BC%88%E6%9C%88%EF%BC%89%EF%BD%9E7%E6%9C%8817%E6%97%A5%EF%BC%88%E9%87%91%EF%BC%89/

アプリ連携時(AppIndexing)のsitemapの書き方

   <url>
     <loc>http://example.com/mypage</loc>
     <lastmod>2011-06-27T19:34:00+01:00</lastmod>
     <xhtml:link rel="alternate" href="android-app://com.example/hoge/example.com/list?k=hoge1" />
   </url>

https://developers.google.com/app-indexing/webmasters/server?hl=ja

sitemapの設置階層

とりあえずトップ階層におけばok。

以下サイトマップ公式プロトコルページによると

http://www.sitemaps.org/ja/protocol.html

http://example.co.jp/catalog/sitemap.xml に置いた場合は、
http://example.co.jp/catalog/ から始まる URL を含めることができますが、
http://example.co.jp/images/ から始まる URL を含めることはできません。

ただし、googleのSearchConsoleに登録していれば階層が別になっててもgoogle検索においては問題ない。

dir内のsitemapをトップ階層でアクセスする方法(nginx)は以下のとおり

linux/nginx/sitemap_rewrite [ショートカット]

複数のサイトマップを一括登録する方法

<?xml version="1.0" encoding="UTF-8"?>
  <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <sitemap>
     <loc>http://www.example.com/sitemap1.xml.gz</loc>
     <lastmod>2004-10-01T18:23:17+00:00</lastmod>
  </sitemap>
  <sitemap>
     <loc>http://www.example.com/sitemap2.xml.gz</loc>
     <lastmod>2005-01-01</lastmod>
  </sitemap>
  </sitemapindex>

オプションはlastmodのみ。changefreqはないので注意。

ドメイン別のサイトマップについて

ドメインが別なサイトマップを一緒にSitemapIndex登録することはできない。

参考:https://support.google.com/webmasters/answer/75712?hl=ja

PubSubHubbubとは

高速indexさせるためのツール

参考

https://www.peko.co.jp/search-console/function/xml-sitemap-3015