hugo-theme-stack/layouts/partials/widget/categories.html
2023-01-17 11:49:45 -05:00

25 lines
991 B
HTML

{{- $query := first 1 (where (where .Context.Site.Pages "Kind" "taxonomy") "Type" "categories") -}}
{{- $context := .Context -}}
{{- $limit := default 10 .Params.limit -}}
{{- if $query -}}
{{- $categoriesPage := index $query 0 -}}
<section class="widget tagCloud">
<div class="widget-icon">
{{ partial "helper/icon" "categories" }}
</div>
<h2 class="widget-title section-title">
<a class="widget-link" href="{{ $categoriesPage.RelPermalink }}">{{ default "Categories" $categoriesPage.Title }}</a>
</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>
{{- else -}}
{{- warnf "Categories page not found. Please enable the categories taxonomy." -}}
{{- end -}}