Skip to content


WordPress -Google Sitemap Generator(sitemap.xml)をモバイルに対応させる

このエントリーをはてなブックマークに追加
はてなブックマーク - WordPress -Google Sitemap Generator(sitemap.xml)をモバイルに対応させる
Share on Facebook
Post to Google Buzz
Bookmark this on Yahoo Bookmark
Bookmark this on Livedoor Clip
Share on FriendFeed
Share on GREE

どうせなら携帯版のgoogle検索でも表示されて欲しいなーと思ってちょっと調べてみた。
Google Sitemap Generator(Xml Sitemap Generator)というWordpressのプラグインを使ってsitemap.xmlを作成していた。

このプラグインを少々改造することでモバイル検索対応とすることができるらしい(携帯用のgoogleのロボット検索が携帯用サイトとして認識してくれる)

手順は以下の通り。
なお、Google Sitemap Generatorプラグインは導入済みであることが前提。

  1. 修正対象ファイルは一つ →[WordpressのHOME]/wp-content/plugins/google-sitemap-generator/sitemap-core.php
  2. 523ステップ目あたりに以下を追加
  3. if($this->_priority!==false && $this->_priority!=="") $r.= "\t\t
    " . number_format($this->_priority,1) . "\n";


    $r.= “\t\t<mobile:mobile/>”;
    $r.= “\n\t</url>\n”;
    return $r;
  4. 1784ステップ目あたりに以下の要素を追加
  5. $this->AddElement(new GoogleSitemapGeneratorXmlEntry('<urlset xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'));
    ※該当箇所は「urlset」をキーに検索をかけるとすぐに見つかります。
  6. 管理者画面のXML-Sitemapからsitemap.xmlを再構築する
  7. 念のため、googleウェブマスターツールでsitemap.xmlの再送信を行う
  8. →記入ミスなどがあったら×印で教えてくれます。

googleウェブマスターツールって何じゃそれ?って方はググれカs(ry

嘘ですごめんなさいm(_ _)m

この辺の記事をご覧になると良く分かると思います。
でも実際使ってみるのが一番ですが!

関連するかもしれない記事



他のブログも読む

Posted in WordPress.

Tagged with , , , .


One Response

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Continuing the Discussion

  1. てすと linked to this post on 2009年10月9日

    トラバてすと

    てすとです。



Some HTML is OK

or, reply to this post via trackback.

*