From 59c7d4567380d1a9c80e96eb958fdbdd512ce006 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Sun, 3 Nov 2024 20:08:36 +0300 Subject: новая жизнь блога MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../layouts/partials/widget/archives.html | 35 ++++++++++++++++++++++ .../layouts/partials/widget/categories.html | 16 ++++++++++ .../layouts/partials/widget/search.html | 16 ++++++++++ .../layouts/partials/widget/tag-cloud.html | 16 ++++++++++ .../layouts/partials/widget/toc.html | 12 ++++++++ 5 files changed, 95 insertions(+) create mode 100644 themes/hugo-theme-stack/layouts/partials/widget/archives.html create mode 100644 themes/hugo-theme-stack/layouts/partials/widget/categories.html create mode 100644 themes/hugo-theme-stack/layouts/partials/widget/search.html create mode 100644 themes/hugo-theme-stack/layouts/partials/widget/tag-cloud.html create mode 100644 themes/hugo-theme-stack/layouts/partials/widget/toc.html (limited to 'themes/hugo-theme-stack/layouts/partials/widget') diff --git a/themes/hugo-theme-stack/layouts/partials/widget/archives.html b/themes/hugo-theme-stack/layouts/partials/widget/archives.html new file mode 100644 index 0000000..1f2abc5 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/widget/archives.html @@ -0,0 +1,35 @@ +{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "archives") -}} +{{- $context := .Context -}} +{{- $limit := default 5 .Params.limit -}} +{{- if $query -}} + {{- $archivesPage := index $query 0 -}} +
+
+ {{ partial "helper/icon" "infinity" }} +
+

{{ T "widget.archives.title" }}

+ + {{ $pages := where $context.Site.RegularPages "Type" "in" $context.Site.Params.mainSections }} + {{ $notHidden := where $context.Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + {{ $archives := $filtered.GroupByDate "2006" }} + +
+ {{ range $index, $item := first (add $limit 1) ($archives) }} + {{- $id := lower (replace $item.Key " " "-") -}} + + {{ end }} +
+
+{{- else -}} + {{- warnf "Archives page not found. Create a page with layout: archives." -}} +{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/widget/categories.html b/themes/hugo-theme-stack/layouts/partials/widget/categories.html new file mode 100644 index 0000000..10c8a35 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/widget/categories.html @@ -0,0 +1,16 @@ +{{- $context := .Context -}} +{{- $limit := default 10 .Params.limit -}} +
+
+ {{ partial "helper/icon" "categories" }} +
+

{{ T "widget.categoriesCloud.title" }}

+ +
+ {{ range first $limit $context.Site.Taxonomies.categories.ByCount }} + + {{ .Page.Title }} + + {{ end }} +
+
diff --git a/themes/hugo-theme-stack/layouts/partials/widget/search.html b/themes/hugo-theme-stack/layouts/partials/widget/search.html new file mode 100644 index 0000000..7b0fc73 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/widget/search.html @@ -0,0 +1,16 @@ +{{- $query := first 1 (where .Context.Site.Pages "Layout" "==" "search") -}} +{{- if $query -}} + {{- $searchPage := index $query 0 -}} +
+

+ + + + +

+
+{{- else -}} + {{- warnf "Search page not found. Create a page with layout: search." -}} +{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/widget/tag-cloud.html b/themes/hugo-theme-stack/layouts/partials/widget/tag-cloud.html new file mode 100644 index 0000000..e64e5e2 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/widget/tag-cloud.html @@ -0,0 +1,16 @@ +{{- $context := .Context -}} +{{- $limit := default 10 .Params.limit -}} +
+
+ {{ partial "helper/icon" "tag" }} +
+

{{ T "widget.tagCloud.title" }}

+ +
+ {{ range first $limit $context.Site.Taxonomies.tags.ByCount }} + + {{ .Page.Title }} + + {{ end }} +
+
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/widget/toc.html b/themes/hugo-theme-stack/layouts/partials/widget/toc.html new file mode 100644 index 0000000..e311de3 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/widget/toc.html @@ -0,0 +1,12 @@ +{{ if (.Context.Scratch.Get "TOCEnabled") }} +
+
+ {{ partial "helper/icon" "hash" }} +
+

{{ T "article.tableOfContents" }}

+ +
+ {{ .Context.TableOfContents }} +
+
+{{ end }} \ No newline at end of file -- cgit v1.2.3