FC2ブログの無更新広告記事でテンプレート変数が出力する文字列

FC2ブログは一ヶ月間エントリを書かないと自動で広告記事が挿入されるようになってるが、それが原因でブログの表示が変になったり、場合によってはテンプレートが壊れて正常に表示されなくなることがある。テンプレートの改造、もしくは作成時にはそのあたりもなるべく考慮した方がいいので、テンプレート変数が広告記事にどんな文字列を返してくるかまとめた。

広告記事の場合にテンプレート変数が表示する文字

変数出力される文字列
<%topentry_no>なし
<%topentry_title>なし
<%topentry_body>長いので下に別途記載
<%topentry_link>http://[ui].blog[sn].fc2.com/?google" target="_new
<%topentry_enc_link>なし
<%topentry_year>
<%topentry_month>
<%topentry_day>
<%topentry_hour>
<%topentry_second>
<%topentry_youbi>
<%topentry_wayoubi>
--
<%topentry_discription>なし
<%topentry_category_no>なし
<%topentry_category>スポンサー広告
<%topentry_category_link>http://[ui].blog[sn].fc2.com/?google
<%topentry_comment_num>
<%topentry_tb_num>
-
<%topentry_tb_no>なし
<%topentry_jointtag>なし(タグが設定されていないため)

注意点

  • 「なし」は何も出力されない。(半角空白も含まれない。)
  • [ui]はユーザID[sn]はサーバ番号を表している。
  • 上の表の「-」は半角ハイフンだが、ソースとしては実体文字参照の「&#45;」が出力される。
  • <%topentry_link>」で出力される文字列(URL)にはtargetを閉じる「"(ダブルクォーテーション)」が存在しないが、脱字ではなくこれで正しい。恐らくテンプレートのタグの属性を「"」で括ってあると決めうちして、広告を新しいウィンドウやタブで開くため。(当然「'(シングルクォーテーション)」を使っている場合は、存在しないURLを指すことになる。)

広告記事の<%topentry_body>の中身

<!-- google ad -->
<style type="text/css">
<!--
#googleAdContainerNoActive {
    width: 100%;
    padding: 0 0 10px;
    overflow: hidden;
}
#googleAdContainerNoActive .adBlock
{
    padding: 0 20px 8px;
    overflow: hidden;
    background: none;
}
#googleAdContainerNoActive .adBlockHover
{
    padding: 0 20px 8px;
    overflow: hidden;
    //background: #FFEEEE;
}
#googleAdContainerNoActive .adTitle
{
    font-weight: bold;
}
#googleAdContainerNoActive .adDescription
{
    padding: 4px 0 0;
}
#googleAdContainerNoActive .adURL
{
    padding: 3px 0 0;
}
-->
</style>
<div id="googleAdContainerNoActive">
<script type="text/javascript">
<!--
var fc2_blog_no_active_gad_channel = '10桁の数字';
//-->
</script>
<script type="text/javascript" src="http://static.fc2.com/js/ad/googleadsense_blog_no_active.js"></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>

<!-- google ad -->
<span style="font-size:6pt">上記の広告は1ヶ月以上更新のないブログに表示されています。新しい記事を書く事で広告が消せます。</span> 

広告記事が表示された場合の個別記事のページについて

広告記事が表示されている場合は、個別記事のページ(<!--permanent_area-->)に記事がふたつ表示される状態になるので、<!--topentry-->から<!--/topentry-->の中身が記事一覧ページなどと同じように複数(2回)繰り返されることになる。これを考慮して<!--topentry-->を使わないと記事の外(例えばheadタグ内)でタグやURLが壊れたり、あるいはidの重複などが起こる可能性があるので注意が必要。