From e22664be13a89b7e0401c3652340569316bb417e Mon Sep 17 00:00:00 2001 From: Felix Niederwanger Date: Thu, 3 Mar 2022 23:47:10 +0100 Subject: [PATCH] feat(widget): add category widget (#475) * Add category widget Adds the ability to add a category to the widgets. * Adapt to new widget scheme Co-authored-by: Jimmy Cai --- assets/icons/categories.svg | 9 +++++++++ i18n/en.yaml | 3 +++ layouts/partials/widget/categories.html | 16 ++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 assets/icons/categories.svg create mode 100644 layouts/partials/widget/categories.html diff --git a/assets/icons/categories.svg b/assets/icons/categories.svg new file mode 100644 index 0000000..e00ab1d --- /dev/null +++ b/assets/icons/categories.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/i18n/en.yaml b/i18n/en.yaml index 0197d89..3d0ed03 100644 --- a/i18n/en.yaml +++ b/i18n/en.yaml @@ -51,6 +51,9 @@ widget: tagCloud: title: other: Tags + categoriesCloud: + title: + other: Categories search: title: diff --git a/layouts/partials/widget/categories.html b/layouts/partials/widget/categories.html new file mode 100644 index 0000000..10c8a35 --- /dev/null +++ b/layouts/partials/widget/categories.html @@ -0,0 +1,16 @@ +{{- $context := .Context -}} +{{- $limit := default 10 .Params.limit -}} +
+
+ {{ partial "helper/icon" "categories" }} +
+

{{ T "widget.categoriesCloud.title" }}

+ +
+ {{ range first $limit $context.Site.Taxonomies.categories.ByCount }} + + {{ .Page.Title }} + + {{ end }} +
+