forked from Sync/hugo-theme-stack
refactor(widget): taxonomy
widget (#763)
* Add link to navbar sections and refactor names * Prevent duplicate tags and categories information * Add style to the widget links * refactor: add `taxonomy` widget Replaces `categories` and `tag-cloud` widget. * style: remove unused `font_size_{{ .Count }}` in `taxonomy` widget --------- Co-authored-by: Jimmy Cai <hi@jimmycai.com>
This commit is contained in:
parent
5063e8f0b8
commit
4be110e540
@ -65,3 +65,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Color for widget titles */
|
||||
.widget-title a.widget-link {
|
||||
color: var(--accent-color);
|
||||
&:hover {
|
||||
color: var(--accent-color-darker);
|
||||
}
|
||||
}
|
||||
|
@ -74,16 +74,20 @@ type = "archives"
|
||||
limit = 5
|
||||
|
||||
[[widgets.homepage]]
|
||||
type = "categories"
|
||||
type = "taxonomy"
|
||||
|
||||
[widgets.homepage.params]
|
||||
limit = 10
|
||||
type = "tags"
|
||||
icon = "tag"
|
||||
|
||||
[[widgets.homepage]]
|
||||
type = "tag-cloud"
|
||||
type = "taxonomy"
|
||||
|
||||
[widgets.homepage.params]
|
||||
limit = 10
|
||||
type = "categories"
|
||||
icon = "categories"
|
||||
|
||||
[[widgets.page]]
|
||||
type = "toc"
|
||||
|
@ -29,12 +29,6 @@ widget:
|
||||
title: الارشيفات
|
||||
more: اكثر
|
||||
|
||||
tagCloud:
|
||||
title: وسوم
|
||||
|
||||
categoriesCloud:
|
||||
title: التصنيفات
|
||||
|
||||
search:
|
||||
title: بحث
|
||||
placeholder: اكتب...
|
||||
|
@ -35,10 +35,6 @@ widget:
|
||||
archives:
|
||||
title: আর্কাইভ
|
||||
more: আরও
|
||||
tagCloud:
|
||||
title: ট্যাগ
|
||||
categoriesCloud:
|
||||
title: বিভাগ
|
||||
|
||||
search:
|
||||
title: অনুসন্ধান
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Arxiu
|
||||
more: Més
|
||||
tagCloud:
|
||||
title: Etiquetes
|
||||
categoriesCloud:
|
||||
title: Categories
|
||||
|
||||
search:
|
||||
title: Cerca
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Archiv
|
||||
more: Weitere
|
||||
tagCloud:
|
||||
title: Schlagwörter
|
||||
categoriesCloud:
|
||||
title: Kategorien
|
||||
|
||||
search:
|
||||
title: Suche
|
||||
|
@ -28,8 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Αρχειο
|
||||
more: Περισσότερα
|
||||
tagCloud:
|
||||
title: Tags
|
||||
|
||||
search:
|
||||
title: Αναζήτηση
|
||||
|
@ -31,10 +31,6 @@ widget:
|
||||
archives:
|
||||
title: Archives
|
||||
more: More
|
||||
tagCloud:
|
||||
title: Tags
|
||||
categoriesCloud:
|
||||
title: Categories
|
||||
|
||||
search:
|
||||
title: Search
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Archivo
|
||||
more: Más
|
||||
tagCloud:
|
||||
title: Etiquetas
|
||||
categoriesCloud:
|
||||
title: Categorías
|
||||
|
||||
search:
|
||||
title: Búsqueda
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: آرشیو
|
||||
more: بیشتر
|
||||
tagCloud:
|
||||
title: تگ ها
|
||||
categoriesCloud:
|
||||
title: دسته بندی
|
||||
|
||||
search:
|
||||
title: جستجو
|
||||
|
@ -28,8 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Archives
|
||||
more: Autres
|
||||
tagCloud:
|
||||
title: Mots clés
|
||||
|
||||
search:
|
||||
title: Rechercher
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Archívum
|
||||
more: Több
|
||||
tagCloud:
|
||||
title: Cimkék
|
||||
categoriesCloud:
|
||||
title: Kategóriák
|
||||
|
||||
search:
|
||||
title: Keresés
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Arsip
|
||||
more: Lebih
|
||||
tagCloud:
|
||||
title: Tag
|
||||
categoriesCloud:
|
||||
title: Kategori
|
||||
|
||||
search:
|
||||
title: Cari
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Archivi
|
||||
more: Di più
|
||||
tagCloud:
|
||||
title: Tags
|
||||
categoriesCloud:
|
||||
title: Categorie
|
||||
|
||||
search:
|
||||
title: Cerca
|
||||
|
@ -17,10 +17,6 @@ widget:
|
||||
archives:
|
||||
title: アーカイブ
|
||||
more: さらに見る
|
||||
tagCloud:
|
||||
title: タグ
|
||||
categoriesCloud:
|
||||
title: カテゴリ
|
||||
|
||||
search:
|
||||
title: 検索
|
||||
|
@ -29,12 +29,6 @@ widget:
|
||||
title: 보관함
|
||||
more: 더보기
|
||||
|
||||
categoriesCloud:
|
||||
title: 카테고리
|
||||
|
||||
tagCloud:
|
||||
title: 태그
|
||||
|
||||
search:
|
||||
title: 검색
|
||||
placeholder: 검색어를 입력하세요...
|
||||
|
@ -23,10 +23,6 @@ widget:
|
||||
archives:
|
||||
title: Archief
|
||||
more: Meer
|
||||
tagCloud:
|
||||
title: Tags
|
||||
categoriesCloud:
|
||||
title: Categorie
|
||||
|
||||
search:
|
||||
title: Zoeken
|
||||
|
@ -34,11 +34,6 @@ widget:
|
||||
archives:
|
||||
title: Archiwum
|
||||
more: Więcej
|
||||
tagCloud:
|
||||
title: Tagi
|
||||
|
||||
categoriesCloud:
|
||||
title: Kategorie
|
||||
|
||||
search:
|
||||
title: Szukaj
|
||||
|
@ -29,12 +29,6 @@ widget:
|
||||
title: Arquivos
|
||||
more: Mais
|
||||
|
||||
tagCloud:
|
||||
title: Tags
|
||||
|
||||
categoriesCloud:
|
||||
title: Categorias
|
||||
|
||||
search:
|
||||
title: Busca
|
||||
placeholder: Digite algo...
|
||||
|
@ -45,12 +45,6 @@ widget:
|
||||
other: Arquivos
|
||||
more:
|
||||
other: Mais
|
||||
tagCloud:
|
||||
title:
|
||||
other: Tags
|
||||
categoriesCloud:
|
||||
title:
|
||||
other: Categorias
|
||||
|
||||
search:
|
||||
title:
|
||||
|
@ -30,8 +30,6 @@ widget:
|
||||
archives:
|
||||
title: Архивы
|
||||
more: Ещё
|
||||
tagCloud:
|
||||
title: Теги
|
||||
|
||||
search:
|
||||
title: Поиск
|
||||
|
@ -28,8 +28,6 @@ widget:
|
||||
archives:
|
||||
title: เนื้อหาที่เก็บถาวรแล้ว
|
||||
more: อื่นๆ นอกจากนี้
|
||||
tagCloud:
|
||||
title: แท็ก
|
||||
|
||||
search:
|
||||
title: ค้นหา
|
||||
|
@ -23,8 +23,6 @@ widget:
|
||||
archives:
|
||||
title: Arşiv
|
||||
more: Daha fazla
|
||||
tagCloud:
|
||||
title: Etiketler
|
||||
|
||||
search:
|
||||
title: Arama
|
||||
|
@ -29,8 +29,6 @@ widget:
|
||||
archives:
|
||||
title: Архіви
|
||||
more: Більше
|
||||
tagCloud:
|
||||
title: Теґи
|
||||
|
||||
search:
|
||||
title: Пошук
|
||||
|
@ -48,14 +48,6 @@ widget:
|
||||
more:
|
||||
other: Còn nữa
|
||||
|
||||
tagCloud:
|
||||
title:
|
||||
other: Nhãn dán
|
||||
|
||||
categoriesCloud:
|
||||
title:
|
||||
other: Chuỗi bài
|
||||
|
||||
search:
|
||||
title:
|
||||
other: Tìm kiếm
|
||||
|
@ -17,10 +17,6 @@ widget:
|
||||
archives:
|
||||
title: 归档
|
||||
more: 更多
|
||||
tagCloud:
|
||||
title: 标签云
|
||||
categoriesCloud:
|
||||
title: 分类
|
||||
|
||||
search:
|
||||
title: 搜索
|
||||
|
@ -28,10 +28,6 @@ widget:
|
||||
archives:
|
||||
title: Archives
|
||||
more: 更多
|
||||
tagCloud:
|
||||
title: Tags
|
||||
categoriesCloud:
|
||||
title: Categories
|
||||
|
||||
search:
|
||||
title: 搜尋
|
||||
|
@ -29,10 +29,6 @@ widget:
|
||||
archives:
|
||||
title: 紀錄
|
||||
more: 更多
|
||||
tagCloud:
|
||||
title: 標籤雲
|
||||
categoriesCloud:
|
||||
title: 分類
|
||||
|
||||
search:
|
||||
title: 搜尋
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="section-card">
|
||||
<div class="section-details">
|
||||
<h3 class="section-count">{{ T "list.page" (len .Pages) }}</h3>
|
||||
<h1 class="section-term">{{ .Title }}</h1>
|
||||
<h1 class="section-term">{{ default (strings.FirstUpper .Type) .Title }}</h1>
|
||||
{{ with .Params.description }}
|
||||
<h2 class="section-description">{{ . }}</h2>
|
||||
{{ end }}
|
||||
|
@ -7,7 +7,9 @@
|
||||
<div class="widget-icon">
|
||||
{{ partial "helper/icon" "infinity" }}
|
||||
</div>
|
||||
<h2 class="widget-title section-title">{{ T "widget.archives.title" }}</h2>
|
||||
<h2 class="widget-title section-title">
|
||||
<a class="widget-link" href="{{ $archivesPage.RelPermalink }}">{{ T "widget.archives.title" }}</a>
|
||||
</h2>
|
||||
|
||||
{{ $pages := where $context.Site.RegularPages "Type" "in" $context.Site.Params.mainSections }}
|
||||
{{ $archives := $pages.GroupByDate "2006" }}
|
||||
|
@ -1,16 +0,0 @@
|
||||
{{- $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>
|
@ -1,16 +0,0 @@
|
||||
{{- $context := .Context -}}
|
||||
{{- $limit := default 10 .Params.limit -}}
|
||||
<section class="widget tagCloud">
|
||||
<div class="widget-icon">
|
||||
{{ partial "helper/icon" "tag" }}
|
||||
</div>
|
||||
<h2 class="widget-title section-title">{{ T "widget.tagCloud.title" }}</h2>
|
||||
|
||||
<div class="tagCloud-tags">
|
||||
{{ range first $limit $context.Site.Taxonomies.tags.ByCount }}
|
||||
<a href="{{ .Page.RelPermalink }}" class="font_size_{{ .Count }}">
|
||||
{{ .Page.Title }}
|
||||
</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
</section>
|
32
layouts/partials/widget/taxonomy.html
Normal file
32
layouts/partials/widget/taxonomy.html
Normal file
@ -0,0 +1,32 @@
|
||||
{{- $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 -}}
|
Loading…
Reference in New Issue
Block a user