2006/07/28 02:21:19
Googleサイトマップを作成
MODxでGoogleサイトマップを動的生成してやろうという試みです。スニペットにDittoを使用します。
それぞれの説明は何か面倒臭いので適当に調べてみてください。
先ずはテンプレートを作ろう
テンプレート名sitemap_template
とでもしておきましょう。
<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.google.com/schemas/sitemap/0.84"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">
<url>
<loc>[(site_url)]</loc>
<priority>0.9</priority>
<changefreq>always</changefreq>
</url>
[*#content*]
</urlset>
ちなみにUTF-8じゃない環境ではどうなるのか僕も試したことがありません。
チャンクを作ろう
チャンク名sitemap
<url>
<loc>[(site_url)][~[+id+]~]</loc>
<priority>0.5</priority>
<changefreq>always</changefreq>
</url>
これでオッケー。
サイトマップを作ろう
設定ドキュメントエイリアス:適当。フレンドリーURLにしててなおかつsitemapがひとつでいいなら、設定しだいだけどsitemap.xmlとか無難だろうね。
使用テンプレート:さっき作ったsitemap_template
コンテンツタイプ:text/xml
[!Ditto? &startID=`1`&multiLevel=`1`&summarize=`all`&showInMenuOnly=`1`&format=`html`&tpl=`sitemap`]]
startID=`1`
ってとこを、自分が作成したいサイトマップのトップページのMODx上でのIDを指定すればいいです。
その他のパラメーターについては、Dittoダウンロードしたときについてくる説明書よめばいいです。
