为 movable type 建立 sitemap
我想把 tag 也加入 sitemap,但由于 tag 的链接默认是 http://justmymemo.com/mt-search.cgi?tag=tagname&blog_id=1,非常不直观,所以先将其 rewrite 一下,改写为 http://justmymemo.com/tag/tagname 的形式,在 .htaccess 中加入
RewriteRule tag/(.+) /mt-search.cgi?tag=$1&blog_id=1 [PT]
#在后台搜索所有模板,查找
<$MTTagSearchLink$>
#替换为
<$MTBlogURL$>tag/<$MTTagName$>
然后新建一模板,命名为 sitemap.xml
<?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><$MTBlogURL encode_xml="1"$></loc>
<changefreq>daily</changefreq>
<MTEntries lastn="1">
<lastmod><$MTEntryModifiedDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></lastmod>
</MTEntries>
<priority>1.0</priority>
</url><MTArchiveList archive_type="Individual">
<url>
<loc><$MTArchiveLink encode_xml="1"$></loc>
<lastmod><$MTArchiveDate format="%Y-%m-%dT%H:%M:%S"$><$MTBlogTimezone$></lastmod>
<priority>0.8</priority>
</url>
</MTArchiveList>
<MTArchiveList archive_type="Category">
<url>
<loc><$MTArchiveLink encode_xml="1"$></loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
</MTArchiveList><MTArchiveList archive_type="Monthly">
<url>
<loc><$MTArchiveLink encode_xml="1"$></loc>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
</MTArchiveList><MTTags>
<url>
<loc><$MTBlogURL$>tag/<$MTTagName encode_xml="1"$></loc>
<changefreq>weekly</changefreq>
<priority>0.7</priority>
</url>
</MTTags></urlset>
This entry was posted on Sunday, May 20th, 2007 at 4:14 pm and is filed under movable type. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.


