Rename template files for content categories

This commit is contained in:
Helen Chong 2024-09-14 20:48:38 +08:00
parent ec2431bb02
commit c18644199f
3 changed files with 31 additions and 32 deletions

View File

@ -1,18 +0,0 @@
---
title: Content Categories
permalink: /categories/
eleventyComputed:
desc: All content categories on {{ sitemeta.siteName | safe }}.
eleventyNavigation:
order: 10
---
<ul>
{% for category in collections.categories %}
{% set categoryUrl %}/categories/{{ category | slugify }}/{% endset %}
{% set categoryPostCount = collections.contents | filterByCategory(category) | length %}
<li><a href="{{ categoryUrl }}">{{ category }}</a> ({{ categoryPostCount }})</li>
{% endfor %}
</ul>
<p>See all contents on this website in the <a href="/archive/">archive</a>.</p>

View File

@ -1,19 +1,17 @@
--- ---
pagination: title: Content Categories
data: collections.categories
size: 1
alias: category
permalink: /categories/{{ category | slugify }}/
eleventyExcludeFromCollections: true
eleventyComputed: eleventyComputed:
title: 'Content Category: "{{ category | safe }}"' desc: All content categories on {{ sitemeta.siteName | safe }}.
desc: All contents under the "{{ category | safe }}" category on {{ sitemeta.siteName | safe }}. eleventyNavigation:
order: 10
--- ---
{% set contentCount = collections.contents | filterByCategory(category) | length %} <ul>
<h2>{{ contentCount }} Contents Filed Under "{{ category }}"</h2> {% for category in collections.categories %}
{% set categoryUrl %}/categories/{{ category | slugify }}/{% endset %}
{% set categoryPostCount = collections.contents | filterByCategory(category) | length %}
<li><a href="{{ categoryUrl }}">{{ category }}</a> ({{ categoryPostCount }})</li>
{% endfor %}
</ul>
{% set contentList = collections.contents | filterByCategory(category) | reverse %} <p>See all contents on this website in the <a href="/archive/">archive</a>.</p>
{% include "main/archive.njk" %}
<p>See <a href="/categories/">all content categories</a>.</p>

19
src/archive/category.njk Normal file
View File

@ -0,0 +1,19 @@
---
pagination:
data: collections.categories
size: 1
alias: category
permalink: /categories/{{ category | slugify }}/
eleventyExcludeFromCollections: true
eleventyComputed:
title: 'Content Category: "{{ category | safe }}"'
desc: All contents under the "{{ category | safe }}" category on {{ sitemeta.siteName | safe }}.
---
{% set contentCount = collections.contents | filterByCategory(category) | length %}
<h2>{{ contentCount }} Contents Filed Under "{{ category }}"</h2>
{% set contentList = collections.contents | filterByCategory(category) | reverse %}
{% include "main/archive.njk" %}
<p>See <a href="/categories/">all content categories</a>.</p>