タグクラウドを活用したいなら、検索結果のテンプレート改造は必須だ。
というのは、タグウラウドの文字をクリックしたときに表示されるページは「検索結果テンプレート」で生成されるページだからだ。
タグクラウドとは、サイト内で利用されているタグ(キーワードなど)を一覧表示したものである。クラウド(cloud)とは「雲」「大群」などを意味する英単語で、多数のタグが集まった様子を言い表している。よく使われているタグ(キーワード)は大きく表示され、文字の大小の様が雲が漂うようなイメージなので、文字通りタグのクラウド(文字の雲)なのであろう。
タグは利用者が自由にいくつでも付けられるようになっている場合が多いが、タグクラウドは様々な項目に付けられたタグを抽出した一覧である。人気の高いタグや利用頻度の高いタグは大きなフォントや太字、色付けなどで段階的に強調表示するようになっているものが多い。
このタグクラウドは、SEOにも有効である。タグクラウドに指定したタグ(キーワード)は検索エンジンにヒットしやすい。
さらに、検索にヒットしたさいに、メタタグ(メタディスクリプション)の改造がしてないと、グーグルから「重複するメタディスクリプションがあります」とお叱りをうけることになる。だから、検索結果ごとにメタディスクリプションを変更しなければならない。
そのときに使えるのが<$mt:SearchString$>である。
<$mt:SearchString$>は、検索結果を表わすMTタグ。タグクラウドの表示結果は検索結果のページなので、ページごとに違う文字として表示される「代数」のようなものである。これをメタディスクリプションに仕込むとよい。ついでに、メタキーワードにも<$mt:SearchString$>を入れておくとよい。
このように、検索結果のテンプレートを改造することがさらにSEO強化になる。
挿入は、以下の2行のみでOK。
<meta name="description" content="<$mt:SearchString$>は、どもどもなオヤジが大好きです。" />
<meta name="keywords" content="<$mt:SearchString$>,どもども,オヤジギャグ" />
検索結果のテンプレートのサンプル (この内容はカスタマイズ版データと同じ)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" id="sixapart-standard">
<head>
<script type="text/javascript">
/* <![CDATA[ */
var user = <$mt:UserSessionState$>;
/* ]]> */
</script>
<$mt:Include module="HTMLヘッダー"$>
<title><$mt:SearchString$>は<$mt:BlogName encode_html="1"$>:検索結果</title>
<meta name="description" content="<$mt:SearchString$>は、どもどもなオヤジが大好きです。" />
<meta name="keywords" content="<$mt:SearchString$>,どもども,オヤジギャグ" />
<mt:Ignore>Below Javascript adds ajax search capability</mt:Ignore>
<script type="text/javascript">
/* <![CDATA[ */
<mt:IfMoreResults>
function getResults(page) {
page = parseInt(page);
if (timer) window.clearTimeout(timer);
var xh = mtGetXmlHttp();
if (!xh) return false;
var res = results[page];
if (!res) return;
var url = res['next_url'];
if (!url) return;
xh.open('GET', url + '&format=js', true);
xh.onreadystatechange = function() {
if ( xh.readyState == 4 ) {
if ( xh.status && ( xh.status != 200 ) ) {
// error - ignore
} else {
try {
var page_results = eval("(" + xh.responseText + ")");
if ( page_results['error'] == null )
results[page + 1] = page_results['result'];
} catch (e) {
}
}
}
};
xh.send(null);
}
function swapContent(direction) {
if ( direction == undefined ) direction = 1;
var page_span = document.getElementById('current-page');
if (!page_span) return true;
var next_page = direction + parseInt(page_span.innerHTML);
var res = results[next_page];
if (!res) return true;
var content = res['content'];
if (!content) return true;
var div = document.getElementById('search-results');
if (!div) return true;
div.innerHTML = content;
timer = window.setTimeout("getResults(" + next_page + ")", 1*1000);
window.scroll(0, 0);
return false;
}
<mt:Else><mt:IfPreviousResults>
function swapContent(direction) {
return true;
}</mt:IfPreviousResults>
</mt:IfMoreResults>
/* ]]> */
</script>
</head>
<body id="<$mt:BlogTemplateSetID$>" class="mt-search-results <$mt:Var name="page_layout"$>">
<div id="container">
<div id="container-inner">
<$mt:Include module="バナーヘッダー"$>
<div id="content">
<div id="content-inner">
<div id="alpha">
<div id="alpha-inner">
<mt:Ignore><!--
Below is the block to show search results.
This makes an independent block to support
Ajax-based background retrieval of the next search results.
--></mt:Ignore>
<mt:SetVarTemplate id="search_results" name="search_results">
<mt:SearchResults>
<mt:SearchResultsHeader>
<div id="search-results">
<span id="current-page" class="hidden"><$mt:CurrentPage$></span>
<h2 id="page-title" class="search-results-header">
<mt:IfStraightSearch>
「<$mt:SearchString$>」と一致するもの
</mt:IfStraightSearch>
<mt:IfTagSearch>
タグ「<$mt:SearchString$>」が付けられているもの
</mt:IfTagSearch>
</h2>
<div class="search-results-container autopagerize_page_element">
</mt:SearchResultsHeader>
<$mt:Include module="ブログ記事の概要" hide_counts="1"$>
<mt:SearchResultsFooter>
</div><div class="autopagerize_insert_before"></div>
<mt:Ignore><!-- Used with the ajax search capability of the new search class --></mt:Ignore>
<div class="content-nav">
<mt:IfPreviousResults><a href="<$mt:PreviousLink$>" rel="prev" onclick="return swapContent(-1);">< 前</a> </mt:IfPreviousResults><mt:PagerBlock><mt:IfCurrentPage><$mt:Var name="__value__"$><mt:Else><a href="<$mt:PagerLink$>"><$mt:Var name="__value__"$></a></mt:IfCurrentPage><mt:Unless name="__last__"> </mt:Unless></mt:PagerBlock><mt:IfMoreResults> <a href="<$mt:NextLink$>" rel="next" onclick="return swapContent();">次 ></a></mt:IfMoreResults>
</div>
</div>
</mt:SearchResultsFooter>
</mt:SearchResults>
</mt:SetVarTemplate>
<mt:Ignore><!-- Display search results constructed in the block above --></mt:Ignore>
<$mt:Var name="search_results"$>
<mt:Ignore><!-- Display no results message --></mt:Ignore>
<mt:NoSearchResults>
<h1 id="page-title" class="search-results-header">
<mt:IfStraightSearch>
「<$mt:SearchString$>」と一致するもの
</mt:IfStraightSearch>
<mt:IfTagSearch>
タグ「<$mt:SearchString$>」が付けられているもの
</mt:IfTagSearch>
</h1>
<p>「<$mt:SearchString$>」と一致する結果は見つかりませんでした。</p>
</mt:NoSearchResults>
<mt:Ignore><!-- Display instructions for searching if search script was accessed without a query --></mt:Ignore>
<mt:NoSearch>
<h1 id="page-title" class="search-results-header">例</h1>
<p>すべての単語が順序に関係なく検索されます。フレーズで検索したいときは引用符で囲んでください。</p>
<blockquote>
<p><code>"movable type"</code></p>
</blockquote>
<p>AND、OR、NOTを入れることで論理検索を行うこともできます。</p>
<blockquote>
<p><code>個人 OR 出版</code></p>
<p><code>個人 NOT 出版</code></p>
</blockquote>
</mt:NoSearch>
<mt:Ignore><!-- Used with the ajax search capability of the new search class --></mt:Ignore>
<mt:IfMoreResults>
<script type="text/javascript">
<!--
var div = document.getElementById('search-results');
var results = {
'<$mt:CurrentPage$>': {
'content': div.innerHTML,
'next_url': '<$mt:NextLink$>'
}
};
var timer = window.setTimeout("getResults(" + <$mt:CurrentPage$> + ")", 1*1000);
//-->
</script>
</mt:IfMoreResults>
</div>
</div>
<$mt:Include module="サイドバー"$>
</div>
</div>
<$mt:Include module="バナーフッター"$>
</div>
</div>
</body>
</html>
フェイスブックの「いいね」はいいですね。
![]()
|
遠田幹雄の業務経歴書の請求はこちら
のメールフォームからどうぞ
それぞれSSLのフォームになっています。