diff options
author | vimux <vimux@protonmail.com> | 2021-04-07 20:48:11 +0300 |
---|---|---|
committer | vimux <vimux@protonmail.com> | 2021-04-07 21:01:44 +0300 |
commit | f10eb9fbdf06a1e591834b608af13c2d6d21ad18 (patch) | |
tree | 01eedf44af510b0e658f4d56299af2c1d3d2c4c9 | |
parent | 7a8d39804cc53adfc68b7464d7e8491e0520d112 (diff) |
Categories widget: add categories_counter param
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | assets/css/style.css | 10 | ||||
-rw-r--r-- | layouts/partials/widgets/categories.html | 3 |
3 files changed, 14 insertions, 0 deletions
@@ -112,6 +112,7 @@ googleAnalytics = "" # Enable Google Analytics by entering your tracking id [Params.widgets] recent_num = 5 # Set the number of articles in the "Recent articles" widget + categories_counter = false # Enable counter for each category in "Categories" widget tags_counter = false # Enable counter for each tag in "Tags" widget [Params.widgets.social] diff --git a/assets/css/style.css b/assets/css/style.css index a73034c..07edf16 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -1077,6 +1077,16 @@ textarea { padding-top: 0; } +.widget__counter--bubble { + display: inline-block; + padding: 0 6px; + font-size: .75rem; + color: #666; + text-align: center; + background: #ebebeb; + border-radius: 2em; +} + /* Search widget */ .widget-search__form { display: block; diff --git a/layouts/partials/widgets/categories.html b/layouts/partials/widgets/categories.html index 30f12aa..77a9318 100644 --- a/layouts/partials/widgets/categories.html +++ b/layouts/partials/widgets/categories.html @@ -8,6 +8,9 @@ {{- with $.Site.GetPage (printf "/categories/%s" $name) }} <li class="widget__item"> <a class="widget__link" href="{{ .RelPermalink }}">{{ .Title }}</a> + {{- if .Site.Params.widgets.categories_counter }} + <span class="widget__counter widget__counter--bubble">{{ $taxonomy.Count }}</span> + {{ end -}} </li> {{- end }} {{- end }} |