mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-02-06 20:03:31 +08:00
32 lines
1.3 KiB
HTML
32 lines
1.3 KiB
HTML
|
{{- $query := first 1 (where (where .Context.Site.Pages "Kind" "taxonomy") "Type" .Params.type) -}}
|
||
|
{{- $context := .Context -}}
|
||
|
{{- $limit := default 10 .Params.limit -}}
|
||
|
{{- $hideInTaxonomyPage := default true .Params.hideInTaxonomyPage -}}
|
||
|
{{- if $query -}}
|
||
|
{{- $taxonomyPage := index $query 0 -}}
|
||
|
{{- $isTaxonomyPage := eq .Context $taxonomyPage -}}
|
||
|
{{- if not (and $isTaxonomyPage $hideInTaxonomyPage) -}}
|
||
|
<section class="widget tagCloud">
|
||
|
<div class="widget-icon">
|
||
|
{{- partial "helper/icon" (default "tag" .Params.icon) -}}
|
||
|
</div>
|
||
|
<h2 class="widget-title section-title">
|
||
|
<a class="widget-link" href="{{ $taxonomyPage.RelPermalink }}">
|
||
|
{{- default $taxonomyPage.Title .Params.title -}}
|
||
|
</a>
|
||
|
</h2>
|
||
|
|
||
|
<div class="tagCloud-tags">
|
||
|
{{- $pages := index $context.Site.Taxonomies .Params.type -}}
|
||
|
{{- $pagesSorted := $pages.ByCount -}}
|
||
|
{{- range first $limit $pagesSorted -}}
|
||
|
<a href="{{ .Page.RelPermalink }}">
|
||
|
{{- .Page.Title -}}
|
||
|
</a>
|
||
|
{{- end -}}
|
||
|
</div>
|
||
|
</section>
|
||
|
{{- end -}}
|
||
|
{{- else -}}
|
||
|
{{- warnf "Taxonomy [%s] not found." .Params.type -}}
|
||
|
{{- end -}}
|