LoginSignup
3
3

More than 5 years have passed since last update.

Octopress Top Categories Plugin を使う

Posted at

サイドバーに表示するカテゴリリストを投稿数の多い順&上位○件 の表示にするプラグインです。

先生はこちら。

プラグインのダウンロード

ctdk/octopress-category-list - GitHub から plugins/category_list.rb を自分の octopress リポジトリの plugins/ へコピーします。

サイドバーに TopCategoryList を表示するための HTML を用意する

自分の octopress リポジトリの source/_includes/custom/asides/top_category_list.html というファイルを作成、内容は以下のようにする。

top_category_list.html
<section>
  <h1>Top Categories</h1>
    <ul id="top-category-list">{% top_category_list counter:true %}</ul>
</section>

top_category_list.html を使用するように設定を書き換える

自分の octopress リポジトリの _config.yml をエディタで開き、

以下のように変更する

_config.yml
# [変更]custom/asides/top_category_list.html を任意の位置に挿入する
default_asides: [custom/asides/about.html, asides/recent_posts.html, custom/asides/top_category_list.html]


# [追加]カテゴリの表示件数
top_category_limit: 15

動かす

rake generate して rake preview して確認した後、rake deploy しましょう。

自分のブログに適用してみました。

Top Category List だけだと当然ながらすべてのカテゴリがわからないので、別途全てのカテゴリを列挙するページを作って、'view All-Categories' でリンクしてます。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3