jekyll でのタグの取り扱いについて
Published: 2019/2/24
このブログのタグページを作りたいだけなのだけれども、 やたら情報が錯綜していて苦労してしまったので、 備忘を兼ねて記録を残す。
一言で
jekyll-archives
を使いましょう。
公式 Plugin ページ にも載っていて、ほぼほぼ安定していると思われます。
作業手順
Gemfile
に以下を追加。
group :jekyll_plugins do
gem 'jekyll-archives'
end
_config.yml
に次を設定
plugins:
- jekyll-archives
# その他 plugins...
jekyll-archives:
enabled: [tags]
layouts:
tag: tag
permalinks:
tag: '/tags/:name/'
_layout/tag.html
に以下を作成
---
layout: default
title: {{ page.title }}
---
<h1>'{{ page.title }}' の一覧</h1>
{% for post in page.posts %}
<!-- post を使って何かやる。 index.html と同じ感じ -->
{% endfor %}
これであとは各 post に、
---
tags: [tag1, tag2]
---
と記述することで、よろしくタグページが/tags/tag1
などに生成される。
Tags: jekyll
You should not use `dbi` gem in Rails project.
CircleCI で You must use Bundler 2 or greater with this lockfile と言われた場合の対処
関連記事
`JEKYLL_LOG_LEVEL=debug` なる環境変数について
2019/11/5
素の jekyll に bootstrap 4 を導入するまでにやったこと
2019/2/27