- 2009-07-23 (木) 21:00
- MovableType


- サイトマップ作ってみた
自分ではなんでなのか全然解ってないが、どうやらサイトにはサイトマップってのが必要らしい。
「それってアーカイブ?」とか思うのだが、微妙に違うようだ。
sitemap.xml なら目的がはっきりしていて解りやすいのだが、なんなのだろう?
一応Webネタでは流行にビンカンでありたいと思っているので、作ってみる事にした。(「いや、流行ってねぇだろ」というツッコミは無しで・・・)
「年別記事一覧をさらにカテゴリ別に分類する - The blog of H.Fujimoto」
藤本さんの SearchEntries プラグイン使ってみたら面白かったので、それを使用(つまり要SearchEntriesプラグインです)して、カテゴリーの中に年・月・エントリーが入れ子になるように作ってみた。
ベースはもちろんmt.Vicunaなので、他のテンプレートの場合はそれなりに修正してください。
<MTSetVars>
tempName=siteMap
page_title=サイトマップ
page_layout=single
</MTSetVars><?xml version="1.0" encoding="<$MTPublishCharset$>" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="<$MTDefaultLanguage$>" xml:lang="<$MTDefaultLanguage$>">
<head profile="http://purl.org/net/ns/metaprof">
<MTInclude module="共通Head内要素">
<MTIfNonEmpty tag="MTBlogDescription"><meta name="description" content="<$MTBlogDescription encode_html="1"$>" /></MTIfNonEmpty>
<meta name="robots" content="INDEX, FOLLOW" />
<title><$MTGetVar name="page_title"$></title>
</head>
<body class="siteMap <$MTVar name="page_layout"$> f850">
<$MTInclude module="ヘッダー"$>
<div id="content">
<div id="main">
<$MTInclude module="パンくずリスト"$>
<h1 id="title"><$MTBlogName encode_html="1"$>:SiteMap</h1>
<div class="section siteMap">
<h2 id="pagedescription">ここのサイトマップです。</h2>
<div class="textBody">
<ul>
<mt:TopLevelCategories>
<MTIf tag="MTCategoryCount">
<$mt:CategoryId setvar="cat_id">
<li><MTCategoryLabel>
<ul>
<MTArchiveList archive_type="Monthly">
<mt:ArchiveDate format="%Y%m%d%H%M%S" setvar="archive_start">
<mt:ArchiveDateEnd format="%Y%m%d%H%M%S" setvar="archive_end">
<mt:SearchConditions>
<mt:SearchConditionCompare field="authored_on" ge="$archive_start" le="$archive_end">
<mt:SearchConditionCategorySection><mt:SearchConditionCategoryId include_cat_ids="$cat_id"></mt:SearchConditionCategorySection>
</mt:SearchConditions>
<MTArchiveDateHeader><$MTSetVar name="EntryCounter" value="0"$>
<MTSetVarBlock name="Listings">
<li><MTArchiveDate format="%Y">
<ul>
</MTSetVarBlock>
</MTArchiveDateHeader>
<mt:IfNonZero tag="SearchFoundEntryCount">
<MTSetVarBlock name="Listings" append="1">
<li><MTArchiveDate format="%m">
<ul>
<mt:Entries>
<li><a href="<$MTEntryLink$>"><$MTEntryTitle$></a></li><$MTSetVar name="EntryCounter" op="++"$>
</mt:Entries>
</ul>
</li>
</MTSetVarBlock>
</mt:IfNonZero>
<MTArchiveDateFooter>
<MTSetVarBlock name="Listings" append="1">
</ul>
</li>
</MTSetVarBlock>
<MTUnless name="EntryCounter" eq="0"><$MTVar name="Listings"$></MTUnless>
</MTArchiveDateFooter>
</MTArchiveList>
</ul>
</li>
</MTIf>
<$mt:SubCatsRecurse$>
</mt:TopLevelCategories>
</ul>
<MTPages no_folder="1">
<MTPagesHeader>
<ul>
</MTPagesHeader>
<li><a href="<$MTPagePermalink$>"><$MTPageTitle$></a></li>
<MTPagesFooter>
</ul>
</MTPagesFooter>
</MTPages>
<ul>
<li>
<MTTopLevelFolders>
<MTFolderHeader>
<ul>
</MTFolderHeader>
<li><a href="<$MTBlogURL$><$MTFolderPath$>/"><$MTFolderDescription$></a><$MTFolderLabel setvar="this_folder"$>
<MTPages folder="$this_folder"><$MTPageBasename setvar="ThisPageName"$>
<MTPagesHeader>
<MTUnless name="ThisPageName" like="index">
<ul>
</MTUnless>
</MTPagesHeader>
<MTUnless name="ThisPageName" like="index">
<li><a href="<$MTPagePermalink$>"><$MTPageTitle$></a></li>
</MTUnless>
<MTPagesFooter>
<MTUnless name="ThisPageName" like="index">
</ul>
</MTUnless>
</MTPagesFooter>
</MTPages>
<MTSubFolderRecurse>
</li>
<MTFolderFooter>
</ul>
</MTFolderFooter>
</MTTopLevelFolders>
</li>
</ul>
</div>
<$MTInclude module="ページ上部へ戻る"$>
</div>
<$MTInclude module="フッター"$>
</div>
</div>
</body>
</html>
後ろにウェブページもくっ付けてるけど、そちらは好みで。
出力結果忘れてた。
- Newer >: Weave入れてると、コメントAuthがおかしい
- Newer in MovableType »: Custom Headerでタイトル画像を変更
- < Older: MT4iを少しいじってみた
ping a Trackback
- TrackBack URL for this entry.(1)





スクリプトの読み込みが完了していません。
メールフォーム(Javascriptを使用していません)や、
Twitter経由のCommentでもReplyいたします。ただし返信はブログのコメントとして行う事もあります。