6.43 サイトマップを作る
P.586
サイトマップ用のテンプレート作成
・テンプレート名:サイトマップ(名前は何でもいいです)
・出力ファイル名:sitemap.xml
・テンプレートの種類:カスタムインデックステンプレート
・テンプレートの内容:次の内容を設定します
<?xml version="1.0" encoding="<mt:publishCharset />"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc><mt:blogURL encode_xml="1" /></loc>
<lastmod><mt:date format="%Y-%m-%dT%H:%M:%S" /><mt:blogTimezone /></lastmod>
<changefreq>daily</changefreq>
</url>
<mt:ifArchiveTypeEnabled archive_type="Individual">
<mt:blogEntryCount setvar="blog_entry_count" />
<mt:entries lastn="$blog_entry_count">
<url>
<loc><mt:entryPermalink encode_xml="1" /></loc>
<lastmod><mt:entryModifiedDate format="%Y-%m-%dT%H:%M:%S" /><mt:blogTimezone /></lastmod>
<priority>1.0</priority>
</url>
</mt:entries>
</mt:ifArchiveTypeEnabled>
<mt:ifArchiveTypeEnabled archive_type="Page">
<mt:pages>
<url>
<loc><mt:pagePermalink encode_xml="1" /></loc>
<lastmod><mt:pageModifiedDate format="%Y-%m-%dT%H:%M:%S" /><mt:blogTimezone /></lastmod>
<priority>1.0</priority>
</url>
</mt:pages>
</mt:ifArchiveTypeEnabled>
<mt:archives>
<mt:unless tag="archiveTypeLabel" like="ブログ記事|ウェブページ">
<mt:archiveList>
<url>
<loc><mt:ArchiveLink encode_xml="1" /></loc>
<mt:entries lastn="1" sort_by="modified_on">
<lastmod><mt:entryModifiedDate format="%Y-%m-%dT%H:%M:%S" /><mt:blogTimezone /></lastmod>
</mt:entries>
</mt:archiveList>
</mt:unless>
</mt:archives>
<url>
<loc><mt:link template="アーカイブインデックス" encode_xml="1" /></loc>
<lastmod><mt:date format="%Y-%m-%dT%H:%M:%S" /><mt:blogTimezone /></lastmod>
</url>
</urlset>
P.587
<mt:entries lastn="1">
<lastmod><mt:entryModifiedDate format="%Y-%m-%dT%H:%M:%S"$><mt:blogTimezone /></lastmod>
</mt:entries>
P.588
インデックステンプレートの正確な更新時刻を取得する
●テンプレートをカスタマイズする
「最近のコメント」ウィジェットテンプレート
...前略...
<url>
<loc><mt:blogURL encode_xml="1" /></loc>
<lastmod><mt:modifiedDate template="メインページ" format="%Y-%m-%dT%H:%M:%S" /><mt:blogTimezone /></lastmod>
<changefreq>daily</changefreq>
</url>
...中略...
<url>
<loc><mt:link template="アーカイブインデックス" encode_xml="1" /></loc>
<lastmod><mt:modifiedDate template="アーカイブインデックス" format="%Y-%m-%dT%H:%M:%S" /><mt:blogTimezone /></lastmod>
</url>
...後略...
タイムゾーンについて
<lastmod><mt:entryModifiedDate utc="1" format="%Y-%m-%dT%H:%M:%SZ"$></lastmod>
注意事項
<mt:encodeText from="ブログの文字コード" to="utf8">
:
</mt:encodeText>