From c18644199f6d38165df1eceff8254d7265dd57fb Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Sat, 14 Sep 2024 20:48:38 +0800 Subject: [PATCH] Rename template files for content categories --- src/archive/categories-list.njk | 18 ------------------ src/archive/categories.njk | 26 ++++++++++++-------------- src/archive/category.njk | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 32 deletions(-) delete mode 100644 src/archive/categories-list.njk create mode 100644 src/archive/category.njk diff --git a/src/archive/categories-list.njk b/src/archive/categories-list.njk deleted file mode 100644 index 90597c26..00000000 --- a/src/archive/categories-list.njk +++ /dev/null @@ -1,18 +0,0 @@ ---- -title: Content Categories -permalink: /categories/ -eleventyComputed: - desc: All content categories on {{ sitemeta.siteName | safe }}. -eleventyNavigation: - order: 10 ---- - - - -

See all contents on this website in the archive.

\ No newline at end of file diff --git a/src/archive/categories.njk b/src/archive/categories.njk index 359ebc7b..da276227 100644 --- a/src/archive/categories.njk +++ b/src/archive/categories.njk @@ -1,19 +1,17 @@ --- -pagination: - data: collections.categories - size: 1 - alias: category -permalink: /categories/{{ category | slugify }}/ -eleventyExcludeFromCollections: true +title: Content Categories eleventyComputed: - title: 'Content Category: "{{ category | safe }}"' - desc: All contents under the "{{ category | safe }}" category on {{ sitemeta.siteName | safe }}. + desc: All content categories on {{ sitemeta.siteName | safe }}. +eleventyNavigation: + order: 10 --- -{% set contentCount = collections.contents | filterByCategory(category) | length %} -

{{ contentCount }} Contents Filed Under "{{ category }}"

+ -{% set contentList = collections.contents | filterByCategory(category) | reverse %} -{% include "main/archive.njk" %} - -

See all content categories.

\ No newline at end of file +

See all contents on this website in the archive.

\ No newline at end of file diff --git a/src/archive/category.njk b/src/archive/category.njk new file mode 100644 index 00000000..359ebc7b --- /dev/null +++ b/src/archive/category.njk @@ -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 %} +

{{ contentCount }} Contents Filed Under "{{ category }}"

+ +{% set contentList = collections.contents | filterByCategory(category) | reverse %} +{% include "main/archive.njk" %} + +

See all content categories.

\ No newline at end of file