From 2be5b483249f2c3f1dacc56912d79af1762745a7 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 19 Feb 2026 17:45:09 +0100 Subject: [PATCH] feat(list): ability to show article tags on homepage (#1270) * feat(list): ability to show article tags on homepage closes https://github.com/CaiJimmy/hugo-theme-stack/issues/880 * Disable showTags by default --- assets/scss/partials/article.scss | 6 ++- config/_default/params.toml | 4 ++ layouts/_partials/article-list/default.html | 2 +- layouts/_partials/article/article.html | 2 +- .../_partials/article/components/details.html | 37 +++++++++++++------ .../_partials/article/components/header.html | 10 +++-- 6 files changed, 41 insertions(+), 20 deletions(-) diff --git a/assets/scss/partials/article.scss b/assets/scss/partials/article.scss index 0286dc4..94c0177 100644 --- a/assets/scss/partials/article.scss +++ b/assets/scss/partials/article.scss @@ -82,7 +82,8 @@ } .article-time, -.article-translations { +.article-translations, +.article-header-tags { display: flex; color: var(--card-text-color-tertiary); gap: 15px; @@ -112,7 +113,8 @@ flex-wrap: wrap; } -.article-translations { +.article-translations, +.article-header-tags { & > div { flex-wrap: wrap; } diff --git a/config/_default/params.toml b/config/_default/params.toml index 7c31901..2583f61 100644 --- a/config/_default/params.toml +++ b/config/_default/params.toml @@ -24,6 +24,10 @@ SortBy = "default" toc = true readingTime = true + [article.list] + # Showing article tags in the list view (e.g. homepage, section pages) + showTags = false + [article.license] enabled = false default = "Licensed under CC BY-NC-SA 4.0" diff --git a/layouts/_partials/article-list/default.html b/layouts/_partials/article-list/default.html index df0e790..c73481e 100644 --- a/layouts/_partials/article-list/default.html +++ b/layouts/_partials/article-list/default.html @@ -1,4 +1,4 @@ {{ $image := partial "helper/image" (dict "Image" .Params.image "Resources" .Resources) }}
- {{ partial "article/components/header" . }} + {{ partial "article/components/header" (dict "Page" . "IsList" true) }}
\ No newline at end of file diff --git a/layouts/_partials/article/article.html b/layouts/_partials/article/article.html index 6bd6015..88d4f53 100644 --- a/layouts/_partials/article/article.html +++ b/layouts/_partials/article/article.html @@ -1,5 +1,5 @@
- {{ partial "article/components/header" . }} + {{ partial "article/components/header" (dict "Page" . "IsList" false) }} {{ if .Scratch.Get "TOCEnabled" }}