Home > Internet > 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>

後ろにウェブページもくっ付けてるけど、そちらは好みで。

出力結果忘れてた。

ping a Trackback

TrackBack URL for this entry.(1)

Please! leave a Comment.

スクリプトの読み込みが完了していません。

メールフォーム(Javascriptを使用していません)や、twitter.pngTwitter経由のCommentでもReplyいたします。ただし返信はブログのコメントとして行う事もあります。

Comment Form

QuickTagsHere

EmoticonHere

(入力しない場合「Anonymous」で代替されます)
(公開はされませんが、Gravatarアイコンの取得や、Comment Subscribeの送信先アドレスとして使われます)
(入力すると、コメント表示でユーザー名にリンクが貼られます)
(この情報は、JavascriptによりCookieに保存されます。)

NotifyMail Powered by Comment Subscribe

はてブコメント:

Home > Internet > Movabletype > サイトマップ作ってみた

AjaxSearch
(5)
(6)

別ページに遷移します。

Powered by 暴想&Dakiny/DigiClo

Tag Cloud

Style References

OpenID accepted here

Accepted OpenID
OpenID認証に対応しています

OpenIDについて

Feeds
Link Status
Read Together
  • LOADING...

ブログ/RSS/キーワードAPI - sidetools

In One

なかのひと

位置情報ブログパーツ「なかのひと」

Links
Powered By

Return to page top