• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

(追記) スキーマのネームスペースが正しくありませんでした。修正しました。最新のネームスペースは適宜参照してください。

検索エンジンに正しくインデックスしてもらうのは大事です。今回モバイルのも同時に作ってみました。

###sitemap.xmlの形式
下記Googleのウェブマスター向けヘルプセンターを参照。

###routes.rbにサイトマップを登録
rails>>
map.m_sitemap 'mobile_sitemap.xml', :controller => "mobile", :action => "sitemap"
map.sitemap 'sitemap.xml', :controller => "top", :action => "sitemap"
<<--

###viewを作成
ファイルを作成します。:app/views/top/sitemap.xml.builder
(注) サイトマップのスキーマが0.9だと、Google,Yahoo, MSNなどのサーチエンジンが読めるようです。
(注) lastmodタグについてはDate.today.xmlschemaのようにxmlschemaが返す表示形式でOKです。
rails>>

sitemap.xml

xml.instruct! :xml, :version=> '1.0', :encoding => 'UTF-8'
xml.urlset :xmlns => 'http://www.sitemaps.org/schemas/sitemap/0.9' do
xml.url do
xml.loc root_url
xml.changefreq 'daily'
xml.priority '0.9'
end

xml.url do
xml.loc help_url
xml.changefreq 'monthly'
xml.priority '0.9'
end
end
<<--
ブラウザからアクセスして、サイトマップが表示されるか確認します。
モバイルサイトマップは下記。
(注) モバイルはまだ標準化されていない?ようで、googleのスキーマ 0.84を指定します。
(注) **モバイル用のname spaceを設定する**必要があります。
rails>>

mobile_sitemap.xml

xml.instruct! :xml, :version=> '1.0', :encoding => 'UTF-8'
xml.urlset :xmlns => 'http://www.google.com/schemas/sitemap/0.84',
"xmlns:mobile" => 'http://www.google.com/schemas/sitemap-mobile/1.0' do
xml.url do
xml.loc m_url
xml.lastmod lastmodified.xmlschema
xml.mobile :mobile
end
<<--

###サイトマップ登録
HTMLに下記を書いておくと、Google, Yahoo!, MSNもとっていってくれます。
rails>>

<<-- [Googleウェブマスターツール](https://www.google.com/webmasters/tools/)でサイトマップを登録すると、サイトマップが正しくない時にエラー+アドバイスをくれるので便利でした。一度目はマスターツールで確認して、それ以降は上記のタグでやるのがよさそうですね。

###Refs
http://brass.to/blog/sitemap_xml_by_rails2_0.html
http://www.google.com/webmasters/tools/
http://www.google.com/support/webmasters/bin/answer.py?answer=35738 googleのサイトマップのエラーと警告について
http://blog.livedoor.jp/botany/archives/50281545.html Google,Yahoo!,MicrosoftがSitemap protocol(サイトマッププロトコル)で合意に

posted by satoko satoko on Thu 10 Jul 2008 at 15:26 with 0 comments
Contents rssrss
NSAssertやNSLogを無効にする:-DNS_BLOCK_ASSERTIONS=1とNS_BLOCK_ASSERTIONS
GDBでview.frameを表示させる
Core Animationについてのリンク集
[iPhone] new BSDライセンスについてライセンス引用のメモ
Implementing a Container View Controller in UIViewController Class Reference
UITableView用のNSIndexPathの作り方
Xcodeのテンプレート、View-based ApplicationとWindow-based Applicationの違い
CopyOnSelectのLion対応
Xcode4のCode Snippetsを別のPCに移動する+gitで管理する
[iPhone] Singleton: iOS4以降はGCDのdispatch_onceを使う
Tags
iphone開発gitIBInterfaceBuilderiOSSIMBLSnippetsterminaltwitterxcodeXcode4
Comments rssrss
guest guest: Muchos turistas buscan la mejor forma de llegar a ... 05/30 03:19
guest guest: San Antonio de Areco es conocido como la cuna de l... 05/27 19:47
guest guest: Optimizar el tiempo durante un viaje de negocios e... 05/18 00:46
guest guest: Para muchos turistas, el transporte publico y la l... 05/15 18:22
Services from s21g
天気ランキング
複数の天気予報サービスの予報と観測結果を比較。週間・月間・年間・通期のランキングや地域別の予報比較から、自分に合う天気予報を探せます。
MagicBag
MagicBagは、Cloudflare R2やS3互換ストレージをMacのFinderから扱えるファイル同期クライアントです。
アンテナショップめぐり
東京にある全国のアンテナショップ、イベント、特産品を地図や条件から探せるサービスです。
YOMU Web小説リーダー
YOMUは、Web小説の読み上げに特化したiPhoneアプリです。
補助探
公開されている補助金・助成金情報を集約し、条件に合う制度を探しやすくするサービスです。