Using jekyll-archives
to create category/tag pages.
This commit is contained in:
parent
aac29d43e5
commit
1889b6b4e0
4 changed files with 17 additions and 7 deletions
1
Gemfile
1
Gemfile
|
@ -7,6 +7,7 @@ group :jekyll_plugins do
|
|||
gem "jekyll-paginate"
|
||||
gem "jekyll-redirect-from"
|
||||
gem "jekyll-seo-tag", "~> 2.6.1"
|
||||
gem "jekyll-archives"
|
||||
end
|
||||
|
||||
group :test do
|
||||
|
|
11
_config.yml
11
_config.yml
|
@ -161,7 +161,6 @@ defaults:
|
|||
label: Home
|
||||
url: /
|
||||
|
||||
|
||||
sass:
|
||||
sass_dir: /assets/css
|
||||
style: compressed
|
||||
|
@ -198,3 +197,13 @@ sitemap_exclude: # Sitemap will exclude the following items.
|
|||
- sitemap.xml
|
||||
- robots.txt
|
||||
- redirects.json
|
||||
|
||||
# see: <https://github.com/jekyll/jekyll-archives/blob/master/docs/configuration.md>
|
||||
jekyll-archives:
|
||||
enabled: [categories, tags]
|
||||
layouts:
|
||||
category: category
|
||||
tag: tag
|
||||
permalinks:
|
||||
tag: '/tags/:name/'
|
||||
category: '/categories/:name/'
|
||||
|
|
|
@ -10,11 +10,11 @@ layout: page
|
|||
<h1 class="pl-lg-2">
|
||||
<i class="far fa-folder-open fa-fw text-muted"></i>
|
||||
{{ page.title }}
|
||||
<span class="lead text-muted pl-2">{{ site.categories[page.category] | size }}</span>
|
||||
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
|
||||
</h1>
|
||||
|
||||
<ul class="post-content pl-0">
|
||||
{% for post in site.categories[page.category] %}
|
||||
{% for post in page.posts %}
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
|
@ -22,4 +22,4 @@ layout: page
|
|||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -11,10 +11,10 @@ layout: page
|
|||
<h1 class="pl-lg-2">
|
||||
<i class="fa fa-tag fa-fw text-muted"></i>
|
||||
{{ page.title }}
|
||||
<span class="lead text-muted pl-2">{{ site.tags[page.tag] | size }}</span>
|
||||
<span class="lead text-muted pl-2">{{ page.posts | size }}</span>
|
||||
</h1>
|
||||
<ul class="post-content pl-0">
|
||||
{% for post in site.tags[page.tag] %}
|
||||
{% for post in page.posts %}
|
||||
<li class="d-flex justify-content-between pl-md-3 pr-md-3">
|
||||
<a href="{{ post.url | relative_url }}">{{ post.title }}</a>
|
||||
<span class="dash flex-grow-1"></span>
|
||||
|
@ -22,4 +22,4 @@ layout: page
|
|||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue