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 <github@jimmycai.com>
This commit is contained in:
parent
d806226ec8
commit
e22664be13
9
assets/icons/categories.svg
Normal file
9
assets/icons/categories.svg
Normal file
@ -0,0 +1,9 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-hash" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path stroke="none" d="M0 0h24v24H0z"/>
|
||||
<line x1="5" y1="9" x2="19" y2="9" />
|
||||
<line x1="5" y1="15" x2="19" y2="15" />
|
||||
<line x1="11" y1="4" x2="7" y2="20" />
|
||||
<line x1="17" y1="4" x2="13" y2="20" />
|
||||
</svg>
|
||||
|
||||
|
After Width: | Height: | Size: 440 B |
@ -51,6 +51,9 @@ widget:
|
||||
tagCloud:
|
||||
title:
|
||||
other: Tags
|
||||
categoriesCloud:
|
||||
title:
|
||||
other: Categories
|
||||
|
||||
search:
|
||||
title:
|
||||
|
16
layouts/partials/widget/categories.html
Normal file
16
layouts/partials/widget/categories.html
Normal file
@ -0,0 +1,16 @@
|
||||
{{- $context := .Context -}}
|
||||
{{- $limit := default 10 .Params.limit -}}
|
||||
<section class="widget tagCloud">
|
||||
<div class="widget-icon">
|
||||
{{ partial "helper/icon" "categories" }}
|
||||
</div>
|
||||
<h2 class="widget-title section-title">{{ T "widget.categoriesCloud.title" }}</h2>
|
||||
|
||||
<div class="tagCloud-tags">
|
||||
{{ range first $limit $context.Site.Taxonomies.categories.ByCount }}
|
||||
<a href="{{ .Page.RelPermalink }}" class="font_size_{{ .Count }}">
|
||||
{{ .Page.Title }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
Loading…
Reference in New Issue
Block a user