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 --- themes/hugo-theme-stack/layouts/404.html | 45 +++++++++ .../layouts/_default/_markup/render-heading.html | 6 ++ .../layouts/_default/_markup/render-image.html | 41 ++++++++ .../layouts/_default/_markup/render-link.html | 3 + .../layouts/_default/archives.html | 35 +++++++ .../hugo-theme-stack/layouts/_default/baseof.html | 28 ++++++ themes/hugo-theme-stack/layouts/_default/list.html | 85 +++++++++++++++++ themes/hugo-theme-stack/layouts/_default/rss.xml | 48 ++++++++++ .../hugo-theme-stack/layouts/_default/single.html | 46 +++++++++ themes/hugo-theme-stack/layouts/index.html | 19 ++++ themes/hugo-theme-stack/layouts/page/search.html | 33 +++++++ themes/hugo-theme-stack/layouts/page/search.json | 26 ++++++ .../layouts/partials/article-list/compact.html | 40 ++++++++ .../layouts/partials/article-list/default.html | 4 + .../layouts/partials/article-list/tile.html | 39 ++++++++ .../layouts/partials/article/article.html | 11 +++ .../partials/article/components/content.html | 5 + .../partials/article/components/details.html | 61 ++++++++++++ .../partials/article/components/footer.html | 19 ++++ .../partials/article/components/header.html | 35 +++++++ .../layouts/partials/article/components/links.html | 30 ++++++ .../layouts/partials/article/components/math.html | 13 +++ .../partials/article/components/photoswipe.html | 68 ++++++++++++++ .../article/components/related-content.html | 13 +++ .../layouts/partials/article/components/tags.html | 7 ++ .../layouts/partials/comments/include.html | 3 + .../partials/comments/provider/beaudar.html | 46 +++++++++ .../layouts/partials/comments/provider/cactus.html | 29 ++++++ .../layouts/partials/comments/provider/cusdis.html | 21 +++++ .../layouts/partials/comments/provider/disqus.html | 22 +++++ .../partials/comments/provider/disqusjs.html | 61 ++++++++++++ .../layouts/partials/comments/provider/giscus.html | 52 +++++++++++ .../layouts/partials/comments/provider/gitalk.html | 31 +++++++ .../partials/comments/provider/remark42.html | 29 ++++++ .../layouts/partials/comments/provider/twikoo.html | 58 ++++++++++++ .../partials/comments/provider/utterances.html | 46 +++++++++ .../layouts/partials/comments/provider/vssue.html | 27 ++++++ .../layouts/partials/comments/provider/waline.html | 34 +++++++ .../layouts/partials/data/description.html | 17 ++++ .../layouts/partials/data/title.html | 38 ++++++++ .../partials/footer/components/custom-font.html | 11 +++ .../layouts/partials/footer/components/script.html | 12 +++ .../layouts/partials/footer/custom.html | 0 .../layouts/partials/footer/footer.html | 23 +++++ .../layouts/partials/footer/include.html | 3 + .../layouts/partials/head/colorScheme.html | 39 ++++++++ .../layouts/partials/head/custom.html | 0 .../layouts/partials/head/head.html | 26 ++++++ .../layouts/partials/head/opengraph/include.html | 2 + .../partials/head/opengraph/provider/base.html | 43 +++++++++ .../partials/head/opengraph/provider/twitter.html | 16 ++++ .../layouts/partials/head/script.html | 0 .../layouts/partials/head/style.html | 3 + .../layouts/partials/helper/external.html | 29 ++++++ .../layouts/partials/helper/icon.html | 6 ++ .../layouts/partials/helper/image.html | 61 ++++++++++++ .../layouts/partials/pagination.html | 26 ++++++ .../layouts/partials/sidebar/left.html | 103 +++++++++++++++++++++ .../layouts/partials/sidebar/right.html | 16 ++++ .../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 +++ .../layouts/shortcodes/bilibili.html | 23 +++++ .../layouts/shortcodes/gitlab.html | 4 + .../hugo-theme-stack/layouts/shortcodes/quote.html | 15 +++ .../layouts/shortcodes/tencent.html | 10 ++ .../hugo-theme-stack/layouts/shortcodes/video.html | 14 +++ .../layouts/shortcodes/youtube.html | 13 +++ 70 files changed, 1867 insertions(+) create mode 100644 themes/hugo-theme-stack/layouts/404.html create mode 100644 themes/hugo-theme-stack/layouts/_default/_markup/render-heading.html create mode 100644 themes/hugo-theme-stack/layouts/_default/_markup/render-image.html create mode 100644 themes/hugo-theme-stack/layouts/_default/_markup/render-link.html create mode 100644 themes/hugo-theme-stack/layouts/_default/archives.html create mode 100644 themes/hugo-theme-stack/layouts/_default/baseof.html create mode 100644 themes/hugo-theme-stack/layouts/_default/list.html create mode 100644 themes/hugo-theme-stack/layouts/_default/rss.xml create mode 100644 themes/hugo-theme-stack/layouts/_default/single.html create mode 100644 themes/hugo-theme-stack/layouts/index.html create mode 100644 themes/hugo-theme-stack/layouts/page/search.html create mode 100644 themes/hugo-theme-stack/layouts/page/search.json create mode 100644 themes/hugo-theme-stack/layouts/partials/article-list/compact.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article-list/default.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article-list/tile.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/article.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/content.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/details.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/footer.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/header.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/links.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/math.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/photoswipe.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/related-content.html create mode 100644 themes/hugo-theme-stack/layouts/partials/article/components/tags.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/include.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/beaudar.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/cactus.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/cusdis.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/disqus.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/disqusjs.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/giscus.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/remark42.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/twikoo.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/utterances.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/vssue.html create mode 100644 themes/hugo-theme-stack/layouts/partials/comments/provider/waline.html create mode 100644 themes/hugo-theme-stack/layouts/partials/data/description.html create mode 100644 themes/hugo-theme-stack/layouts/partials/data/title.html create mode 100644 themes/hugo-theme-stack/layouts/partials/footer/components/custom-font.html create mode 100644 themes/hugo-theme-stack/layouts/partials/footer/components/script.html create mode 100644 themes/hugo-theme-stack/layouts/partials/footer/custom.html create mode 100644 themes/hugo-theme-stack/layouts/partials/footer/footer.html create mode 100644 themes/hugo-theme-stack/layouts/partials/footer/include.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/colorScheme.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/custom.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/head.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/opengraph/include.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/base.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/twitter.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/script.html create mode 100644 themes/hugo-theme-stack/layouts/partials/head/style.html create mode 100644 themes/hugo-theme-stack/layouts/partials/helper/external.html create mode 100644 themes/hugo-theme-stack/layouts/partials/helper/icon.html create mode 100644 themes/hugo-theme-stack/layouts/partials/helper/image.html create mode 100644 themes/hugo-theme-stack/layouts/partials/pagination.html create mode 100644 themes/hugo-theme-stack/layouts/partials/sidebar/left.html create mode 100644 themes/hugo-theme-stack/layouts/partials/sidebar/right.html 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 create mode 100644 themes/hugo-theme-stack/layouts/shortcodes/bilibili.html create mode 100644 themes/hugo-theme-stack/layouts/shortcodes/gitlab.html create mode 100644 themes/hugo-theme-stack/layouts/shortcodes/quote.html create mode 100644 themes/hugo-theme-stack/layouts/shortcodes/tencent.html create mode 100644 themes/hugo-theme-stack/layouts/shortcodes/video.html create mode 100644 themes/hugo-theme-stack/layouts/shortcodes/youtube.html (limited to 'themes/hugo-theme-stack/layouts') diff --git a/themes/hugo-theme-stack/layouts/404.html b/themes/hugo-theme-stack/layouts/404.html new file mode 100644 index 0000000..98f4a67 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/404.html @@ -0,0 +1,45 @@ +{{ define "main" }} +
+

{{ T "notFound.title" }}

+

{{ T "notFound.subtitle" }}

+
+ + {{- $query := first 1 (where .Site.Pages "Layout" "==" "search") -}} + {{- $searchPage := index $query 0 -}} + + {{- with $searchPage -}} +
+

+ + + + +

+
+ +
+

+
+
+ + + + {{- $opts := dict "minify" hugo.IsProduction "JSXFactory" "createElement" -}} + {{- $searchScript := resources.Get "ts/search.tsx" | js.Build $opts -}} + + + + {{- end -}} + {{ partialCached "footer/footer" . }} +{{ end }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/_default/_markup/render-heading.html b/themes/hugo-theme-stack/layouts/_default/_markup/render-heading.html new file mode 100644 index 0000000..f79308a --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/_markup/render-heading.html @@ -0,0 +1,6 @@ + + {{- if site.Params.Article.HeadingAnchor -}} + + {{- end -}} + {{ .Text | safeHTML }} + \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/_default/_markup/render-image.html b/themes/hugo-theme-stack/layouts/_default/_markup/render-image.html new file mode 100644 index 0000000..0ed5584 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/_markup/render-image.html @@ -0,0 +1,41 @@ +{{- $image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}} +{{- $Permalink := .Destination | relURL | safeURL -}} +{{- $alt := .PlainText | safeHTML -}} +{{- $Width := 0 -}} +{{- $Height := 0 -}} +{{- $Srcset := "" -}} + +{{/* SVG and external images won't work with gallery layout, because their width and height attributes are unknown */}} +{{- $galleryImage := false -}} + +{{- if $image -}} + {{- $notSVG := ne (path.Ext .Destination) ".svg" -}} + {{- $Permalink = $image.RelPermalink -}} + + {{- if $notSVG -}} + {{- $Width = $image.Width -}} + {{- $Height = $image.Height -}} + {{- $galleryImage = true -}} + + {{- if (default true .Page.Site.Params.imageProcessing.content.enabled) -}} + {{- $small := $image.Resize `480x` -}} + {{- $big := $image.Resize `1024x` -}} + {{- $Srcset = printf `%s 480w, %s 1024w` $small.RelPermalink $big.RelPermalink -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{ . }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/_default/_markup/render-link.html b/themes/hugo-theme-stack/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..843854d --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/_markup/render-link.html @@ -0,0 +1,3 @@ +{{ .Text | safeHTML }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/_default/archives.html b/themes/hugo-theme-stack/layouts/_default/archives.html new file mode 100644 index 0000000..5d5243c --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/archives.html @@ -0,0 +1,35 @@ +{{ define "body-class" }}template-archives{{ end }} +{{ define "main" }} +
+ {{- $taxonomy := $.Site.GetPage "taxonomyTerm" "categories" -}} + {{- $terms := $taxonomy.Pages -}} + {{ if $terms }} +

{{ $taxonomy.Title }}

+
+
+ {{ range $terms }} + {{ partial "article-list/tile" (dict "context" . "size" "250x150" "Type" "taxonomy") }} + {{ end }} +
+
+ {{ end }} +
+ + {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} + {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + + {{ range $filtered.GroupByDate "2006" }} + {{ $id := lower (replace .Key " " "-") }} +
+

{{ .Key }}

+
+ {{ range .Pages }} + {{ partial "article-list/compact" . }} + {{ end }} +
+
+ {{ end }} + + {{ partialCached "footer/footer" . }} +{{ end }} diff --git a/themes/hugo-theme-stack/layouts/_default/baseof.html b/themes/hugo-theme-stack/layouts/_default/baseof.html new file mode 100644 index 0000000..83fdaa3 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/baseof.html @@ -0,0 +1,28 @@ + + + + {{- partial "head/head.html" . -}} + {{- block "head" . -}}{{ end }} + + + {{- partial "head/colorScheme" . -}} + + {{/* The container is wider when there's any activated widget */}} + {{- $hasWidget := false -}} + {{- range .Site.Params.widgets -}} + {{- if gt (len .) 0 -}} + {{- $hasWidget = true -}} + {{- end -}} + {{- end -}} +
+ {{- block "left-sidebar" . -}} + {{ partial "sidebar/left.html" . }} + {{- end -}} + {{- block "right-sidebar" . -}}{{ end }} +
+ {{- block "main" . }}{{- end }} +
+
+ {{ partial "footer/include.html" . }} + + diff --git a/themes/hugo-theme-stack/layouts/_default/list.html b/themes/hugo-theme-stack/layouts/_default/list.html new file mode 100644 index 0000000..9bc618d --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/list.html @@ -0,0 +1,85 @@ +{{ define "main" }} +
+

+ {{ if eq .Parent (.GetPage "/") }} + {{ T "list.section" }} + {{ else }} + {{ .Parent.Title }} + {{ end }} +

+ +
+
+

{{ T "list.page" (len .Pages) }}

+

{{ .Title }}

+ {{ with .Params.description }} +

{{ . }}

+ {{ end }} +
+ + {{- $image := partialCached "helper/image" (dict "Context" . "Type" "section") .RelPermalink "section" -}} + {{ if $image.exists }} +
+ {{ if $image.resource }} + {{- $Permalink := $image.resource.RelPermalink -}} + {{- $Width := $image.resource.Width -}} + {{- $Height := $image.resource.Height -}} + + {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} + {{- $thumbnail := $image.resource.Fill "120x120" -}} + {{- $Permalink = $thumbnail.RelPermalink -}} + {{- $Width = $thumbnail.Width -}} + {{- $Height = $thumbnail.Height -}} + {{- end -}} + + + {{ else }} + + {{ end }} +
+ {{ end }} +
+
+ + {{- $subsections := .Sections -}} + {{- $pages := .Pages | complement $subsections -}} + + {{- if eq (len $pages) 0 -}} + {{/* If there are no normal pages, display subsections in list style, with pagination */}} + {{/* This happens with taxonomies like categories or tags */}} + {{- $pages = $subsections -}} + {{- $subsections = slice -}} + {{- end -}} + + {{- with $subsections -}} + + {{- end -}} + + {{/* List only pages that are not a subsection */}} + {{ $paginator := .Paginate $pages }} +
+ {{ range $paginator.Pages }} + {{ partial "article-list/compact" . }} + {{ end }} +
+ + {{- partial "pagination.html" . -}} + + {{ partialCached "footer/footer" . }} +{{ end }} + +{{ define "right-sidebar" }} + {{ partial "sidebar/right.html" (dict "Context" . "Scope" "homepage") }} +{{ end }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/_default/rss.xml b/themes/hugo-theme-stack/layouts/_default/rss.xml new file mode 100644 index 0000000..3d2e592 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/rss.xml @@ -0,0 +1,48 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $pages := where $pages "Params.hidden" "!=" true -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "" | safeHTML }} + + + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ .Permalink }} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo -- gohugo.io{{ with .Site.LanguageCode }} + {{.}}{{end}}{{ with .Site.Params.Author.email }} + {{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Params.Author.email }} + {{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}}{{ if not .Date.IsZero }} + {{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{- with .OutputFormats.Get "RSS" -}} + {{ printf "" .Permalink .MediaType | safeHTML }} + {{- end -}} + {{ range $pages }} + {{- $content := safeHTML (.Summary | html) -}} + {{- if .Site.Params.rssFullContent -}} + {{- $content = safeHTML (.Content | html) -}} + {{- end -}} + + {{ .Title }} + {{ .Permalink }} + {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ with .Site.Params.Author.email }}{{.}}{{ with $.Site.Params.Author.name }} ({{.}}){{end}}{{end}} + {{ .Permalink }} + + {{- $image := partial "helper/image" (dict "Context" . "Type" "rss") -}} + {{- if $image.exists -}} + {{ "<" | html }}img src="{{ $image.permalink | absURL }}" alt="Featured image of post {{ .Title }}" {{ "/>" | html}} + {{- end -}}{{ $content }} + + {{ end }} + + diff --git a/themes/hugo-theme-stack/layouts/_default/single.html b/themes/hugo-theme-stack/layouts/_default/single.html new file mode 100644 index 0000000..5f300bf --- /dev/null +++ b/themes/hugo-theme-stack/layouts/_default/single.html @@ -0,0 +1,46 @@ +{{ define "body-class" }} + article-page + {{/* + Enable the right sidebar if + - Widget different from 'TOC' is enabled + - TOC is enabled and not empty + */}} + {{- $HasWidgetNotTOC := false -}} + {{- $TOCWidgetEnabled := false -}} + {{- range .Site.Params.widgets.page -}} + {{- if ne .type "toc" -}} + {{ $HasWidgetNotTOC = true -}} + {{- else -}} + {{ $TOCWidgetEnabled = true -}} + {{- end -}} + {{- end -}} + + {{- $TOCManuallyDisabled := eq .Params.toc false -}} + {{- $TOCEnabled := and (not $TOCManuallyDisabled) $TOCWidgetEnabled -}} + {{- $hasTOC := ge (len .TableOfContents) 100 -}} + {{- .Scratch.Set "TOCEnabled" (and $TOCEnabled $hasTOC) -}} + + {{- .Scratch.Set "hasWidget" (or $HasWidgetNotTOC (and $TOCEnabled $hasTOC)) -}} +{{ end }} + +{{ define "main" }} + {{ partial "article/article.html" . }} + + {{ if .Params.links }} + {{ partial "article/components/links" . }} + {{ end }} + + {{ partial "article/components/related-content" . }} + + {{ if not (eq .Params.comments false) }} + {{ partial "comments/include" . }} + {{ end }} + + {{ partialCached "footer/footer" . }} + + {{ partialCached "article/components/photoswipe" . }} +{{ end }} + +{{ define "right-sidebar" }} + {{ if .Scratch.Get "hasWidget" }}{{ partial "sidebar/right.html" (dict "Context" . "Scope" "page") }}{{ end}} +{{ end }} diff --git a/themes/hugo-theme-stack/layouts/index.html b/themes/hugo-theme-stack/layouts/index.html new file mode 100644 index 0000000..0cd0b88 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/index.html @@ -0,0 +1,19 @@ +{{ define "main" }} + {{ $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections }} + {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + {{ $pag := .Paginate ($filtered) }} + +
+ {{ range $index, $element := $pag.Pages }} + {{ partial "article-list/default" . }} + {{ end }} +
+ + {{- partial "pagination.html" . -}} + {{- partial "footer/footer" . -}} +{{ end }} + +{{ define "right-sidebar" }} + {{ partial "sidebar/right.html" (dict "Context" . "Scope" "homepage") }} +{{ end }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/page/search.html b/themes/hugo-theme-stack/layouts/page/search.html new file mode 100644 index 0000000..fbfb74d --- /dev/null +++ b/themes/hugo-theme-stack/layouts/page/search.html @@ -0,0 +1,33 @@ +{{ define "body-class" }}template-search{{ end }} +{{ define "head" }} + {{- with .OutputFormats.Get "json" -}} + + {{- end -}} +{{ end }} +{{ define "main" }} +
+

+ + +

+ + +
+ +
+

+
+
+ + + +{{- $opts := dict "minify" hugo.IsProduction "JSXFactory" "createElement" -}} +{{- $searchScript := resources.Get "ts/search.tsx" | js.Build $opts -}} + + +{{ partialCached "footer/footer" . }} +{{ end }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/page/search.json b/themes/hugo-theme-stack/layouts/page/search.json new file mode 100644 index 0000000..5d4e627 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/page/search.json @@ -0,0 +1,26 @@ +{{- $pages := where .Site.RegularPages "Type" "in" .Site.Params.mainSections -}} +{{- $notHidden := where .Site.RegularPages "Params.hidden" "!=" true -}} +{{- $filtered := ($pages | intersect $notHidden) -}} + +{{- $result := slice -}} + +{{- range $filtered -}} + {{- $data := dict "title" .Title "date" .Date "permalink" .Permalink "content" (.Plain) -}} + + {{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}} + {{- if $image.exists -}} + {{- $imagePermalink := "" -}} + {{- if and $image.resource (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} + {{- $thumbnail := $image.resource.Fill "120x120" -}} + {{- $imagePermalink = (absURL $thumbnail.Permalink) -}} + {{- else -}} + {{- $imagePermalink = $image.permalink -}} + {{- end -}} + + {{- $data = merge $data (dict "image" (absURL $imagePermalink)) -}} + {{- end -}} + + {{- $result = $result | append $data -}} +{{- end -}} + +{{ jsonify $result }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article-list/compact.html b/themes/hugo-theme-stack/layouts/partials/article-list/compact.html new file mode 100644 index 0000000..376512a --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article-list/compact.html @@ -0,0 +1,40 @@ +
+ +
+

+ {{- .Title -}} +

+
+ +
+
+ + {{- $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" -}} + {{ if $image.exists }} +
+ {{ if $image.resource }} + {{- $Permalink := $image.resource.RelPermalink -}} + {{- $Width := $image.resource.Width -}} + {{- $Height := $image.resource.Height -}} + + {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} + {{- $thumbnail := $image.resource.Fill "120x120" -}} + {{- $Permalink = $thumbnail.RelPermalink -}} + {{- $Width = $thumbnail.Width -}} + {{- $Height = $thumbnail.Height -}} + {{- end -}} + + {{ .Title }} + {{ else }} + Featured image of post {{ .Title }} + {{ end }} +
+ {{ end }} +
+
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article-list/default.html b/themes/hugo-theme-stack/layouts/partials/article-list/default.html new file mode 100644 index 0000000..02e0b30 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article-list/default.html @@ -0,0 +1,4 @@ +{{ $image := partialCached "helper/image" (dict "Context" . "Type" "articleList") .RelPermalink "articleList" }} +
+ {{ partial "article/components/header" . }} +
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article-list/tile.html b/themes/hugo-theme-stack/layouts/partials/article-list/tile.html new file mode 100644 index 0000000..be5744b --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article-list/tile.html @@ -0,0 +1,39 @@ +{{ $image := partialCached "helper/image" (dict "Context" .context "Type" .Type) .context.RelPermalink .Type }} +
+ + + {{ if $image.exists }} +
+ {{ if $image.resource }} + {{- $imageRaw := $image.resource | resources.Fingerprint "md5" -}} + {{- $Permalink := $imageRaw.RelPermalink -}} + {{- $Width := $imageRaw.Width -}} + {{- $Height := $imageRaw.Height -}} + + {{- if .context.Site.Params.imageProcessing.cover.enabled -}} + {{- $thumbnail := $imageRaw.Fill .size -}} + {{- $Permalink = $thumbnail.RelPermalink -}} + {{- $Width = $thumbnail.Width -}} + {{- $Height = $thumbnail.Height -}} + {{- end -}} + + Featured image of post {{ .context.Title }} + {{ else }} + + {{ end }} +
+ {{ end }} + +
+

+ {{- .context.Title -}} +

+
+
+
diff --git a/themes/hugo-theme-stack/layouts/partials/article/article.html b/themes/hugo-theme-stack/layouts/partials/article/article.html new file mode 100644 index 0000000..f3f7e90 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/article.html @@ -0,0 +1,11 @@ +
+ {{ partial "article/components/header" . }} + + {{ partial "article/components/content" . }} + + {{ partial "article/components/footer" . }} + + {{ if or .Params.math .Site.Params.article.math }} + {{ partialCached "article/components/math.html" . }} + {{ end }} +
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/content.html b/themes/hugo-theme-stack/layouts/partials/article/components/content.html new file mode 100644 index 0000000..61e536c --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/content.html @@ -0,0 +1,5 @@ +
+ + {{ $wrappedTable := printf "
${1}
" }} + {{ .Content | replaceRE "((?:.|\n)+?
)" $wrappedTable | safeHTML }} +
diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/details.html b/themes/hugo-theme-stack/layouts/partials/article/components/details.html new file mode 100644 index 0000000..7c27302 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/details.html @@ -0,0 +1,61 @@ +
+ {{ if .Params.categories }} + + {{ end }} + +
+

+ + {{- .Title -}} + +

+ + {{ with .Params.description }} +

+ {{ . }} +

+ {{ end }} +
+ + {{ $showReadingTime := .Params.readingTime | default (.Site.Params.article.readingTime) }} + {{ $showDate := not .Date.IsZero }} + {{ $showFooter := or $showDate $showReadingTime }} + {{ if $showFooter }} +
+ {{ if $showDate }} +
+ {{ partial "helper/icon" "date" }} + +
+ {{ end }} + + {{ if $showReadingTime }} +
+ {{ partial "helper/icon" "clock" }} + +
+ {{ end }} +
+ {{ end }} + + {{ if .IsTranslated }} + + {{ end }} +
diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/footer.html b/themes/hugo-theme-stack/layouts/partials/article/components/footer.html new file mode 100644 index 0000000..9795880 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/footer.html @@ -0,0 +1,19 @@ + diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/header.html b/themes/hugo-theme-stack/layouts/partials/article/components/header.html new file mode 100644 index 0000000..7582ec2 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/header.html @@ -0,0 +1,35 @@ +
+ {{- $image := partialCached "helper/image" (dict "Context" . "Type" "article") .RelPermalink "article" -}} + {{ if $image.exists }} +
+ + {{ if $image.resource }} + {{- $Permalink := $image.resource.RelPermalink -}} + {{- $Width := $image.resource.Width -}} + {{- $Height := $image.resource.Height -}} + {{- $Srcset := "" -}} + + {{- if (default true .Page.Site.Params.imageProcessing.cover.enabled) -}} + {{- $thumbnail := $image.resource.Resize "800x" -}} + {{- $thumbnailRetina := $image.resource.Resize "1600x" -}} + {{- $Srcset = printf "%s 800w, %s 1600w" $thumbnail.RelPermalink $thumbnailRetina.RelPermalink -}} + {{- $Permalink = $thumbnail.RelPermalink -}} + {{- $Width = $thumbnail.Width -}} + {{- $Height = $thumbnail.Height -}} + {{- end -}} + + Featured image of post {{ .Title }} + {{ else }} + Featured image of post {{ .Title }} + {{ end }} + +
+ {{ end }} + + {{ partialCached "article/components/details" . .RelPermalink }} +
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/links.html b/themes/hugo-theme-stack/layouts/partials/article/components/links.html new file mode 100644 index 0000000..a2ac26c --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/links.html @@ -0,0 +1,30 @@ +
+ {{ range $i, $link := .Params.links }} + + {{ end }} +
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/math.html b/themes/hugo-theme-stack/layouts/partials/article/components/math.html new file mode 100644 index 0000000..bd1a7f8 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/math.html @@ -0,0 +1,13 @@ +{{- partial "helper/external" (dict "Context" . "Namespace" "KaTeX") -}} + \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/photoswipe.html b/themes/hugo-theme-stack/layouts/partials/article/components/photoswipe.html new file mode 100644 index 0000000..c33ff49 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/photoswipe.html @@ -0,0 +1,68 @@ + + + +{{- partial "helper/external" (dict "Context" . "Namespace" "PhotoSwipe") -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/related-content.html b/themes/hugo-theme-stack/layouts/partials/article/components/related-content.html new file mode 100644 index 0000000..aba88e3 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/related-content.html @@ -0,0 +1,13 @@ +{{ $related := (where (.Site.RegularPages.Related .) "Params.hidden" "!=" true) | first 5 }} +{{ with $related }} + +{{ end }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/article/components/tags.html b/themes/hugo-theme-stack/layouts/partials/article/components/tags.html new file mode 100644 index 0000000..aae38b4 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/article/components/tags.html @@ -0,0 +1,7 @@ +{{ if .Params.Tags }} +
+ {{ range (.GetTerms "tags") }} + {{ .LinkTitle }} + {{ end }} +
+{{ end }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/comments/include.html b/themes/hugo-theme-stack/layouts/partials/comments/include.html new file mode 100644 index 0000000..a3d0618 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/include.html @@ -0,0 +1,3 @@ +{{ if .Site.Params.comments.enabled }} + {{ partial (printf "comments/provider/%s" .Site.Params.comments.provider) . }} +{{ end }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/beaudar.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/beaudar.html new file mode 100644 index 0000000..761801f --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/beaudar.html @@ -0,0 +1,46 @@ + + + + + diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/cactus.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/cactus.html new file mode 100644 index 0000000..ae172d3 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/cactus.html @@ -0,0 +1,29 @@ +{{- with .Site.Params.comments.cactus -}} +{{- partial "helper/external" (dict "Context" $ "Namespace" "Cactus") -}} + + + +
+ + +{{- end -}} diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/cusdis.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/cusdis.html new file mode 100644 index 0000000..a89746c --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/cusdis.html @@ -0,0 +1,21 @@ +{{- $host := default "https://cusdis.com" .Site.Params.comments.cusdis.host -}} +
+ + + diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/disqus.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/disqus.html new file mode 100644 index 0000000..fb17b77 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/disqus.html @@ -0,0 +1,22 @@ +
+ {{ template "_internal/disqus.html" . }} +
+ + + + \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/disqusjs.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/disqusjs.html new file mode 100644 index 0000000..967c38c --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/disqusjs.html @@ -0,0 +1,61 @@ +{{- $pc := .Site.Config.Privacy.Disqus -}} +{{- $disqusjs := .Site.Params.Comments.disqusjs -}} +{{- if and (not $pc.Disable) (and $disqusjs.Shortname $disqusjs.ApiKey) -}} + +{{- $style := resources.Get "scss/partials/comments/disqusjs.scss" | toCSS | minify -}} + + +
+
+ + +
+{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/giscus.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/giscus.html new file mode 100644 index 0000000..97fbb77 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/giscus.html @@ -0,0 +1,52 @@ +{{- with .Site.Params.comments.giscus -}} + + +{{- end -}} diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html new file mode 100644 index 0000000..54bfcba --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/gitalk.html @@ -0,0 +1,31 @@ +{{- with .Site.Params.comments.gitalk -}} +
+ + + + +{{ end }} diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/remark42.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/remark42.html new file mode 100644 index 0000000..18acf1b --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/remark42.html @@ -0,0 +1,29 @@ +{{- with .Site.Params.comments.remark42 -}} +
+ +{{- end -}} diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/twikoo.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/twikoo.html new file mode 100644 index 0000000..8c22507 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/twikoo.html @@ -0,0 +1,58 @@ + +
+ + +{{- with .Site.Params.comments.twikoo -}} + +{{- end -}} diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/utterances.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/utterances.html new file mode 100644 index 0000000..b1e370b --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/utterances.html @@ -0,0 +1,46 @@ + + + + + diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/vssue.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/vssue.html new file mode 100644 index 0000000..79ac381 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/vssue.html @@ -0,0 +1,27 @@ +{{- with .Site.Params.comments.vssue -}} + + +
+ + + + + +{{- end -}} diff --git a/themes/hugo-theme-stack/layouts/partials/comments/provider/waline.html b/themes/hugo-theme-stack/layouts/partials/comments/provider/waline.html new file mode 100644 index 0000000..9d1a2a0 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/comments/provider/waline.html @@ -0,0 +1,34 @@ + + +
+ + +{{- with .Site.Params.comments.waline -}} +{{- $config := dict "el" "#waline" "dark" `html[data-scheme="dark"]` -}} +{{- $replaceKeys := dict "serverurl" "serverURL" "requiredmeta" "requiredMeta" "wordlimit" "wordLimit" "pagesize" "pageSize" "imageuploader" "imageUploader" "texrenderer" "texRenderer" -}} + +{{- range $key, $val := . -}} + {{- if ne $val nil -}} + {{- $replaceKey := index $replaceKeys $key -}} + {{- $k := default $key $replaceKey -}} + + {{- $config = merge $config (dict $k $val) -}} + {{- end -}} +{{- end -}} + + +{{- end -}} diff --git a/themes/hugo-theme-stack/layouts/partials/data/description.html b/themes/hugo-theme-stack/layouts/partials/data/description.html new file mode 100644 index 0000000..7f6cc32 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/data/description.html @@ -0,0 +1,17 @@ + +{{ $description := .Site.Params.sidebar.subtitle }} + + +{{ if .Site.Params.description }} + {{ $description = .Site.Params.description }} +{{ end }} + +{{ if .Description }} + + {{ $description = .Description }} +{{ else if .IsPage }} + + {{ $description = .Summary }} +{{ end }} + +{{ return (replaceRE "\n" " " $description | plainify) }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/data/title.html b/themes/hugo-theme-stack/layouts/partials/data/title.html new file mode 100644 index 0000000..85a7bc7 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/data/title.html @@ -0,0 +1,38 @@ +{{- $title := .Title -}} +{{- $siteTitle := .Site.Title -}} + +{{- if .IsHome -}} + + + + {{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }} + {{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }} + {{ $filtered := ($pages | intersect $notHidden) }} + {{ $pag := .Paginate ($filtered) }} + + {{ if .Paginator.HasPrev }} + + {{ $title = printf "%s - %s" .Paginator $siteTitle }} + {{ else }} + {{ $title = $siteTitle}} + {{ end }} +{{- else if eq .Kind "term" -}} + + + + {{ $notHidden := where .Pages "Params.hidden" "!=" true }} + {{ $pag := .Paginate ($notHidden) }} + + + {{ $title = slice (title .Data.Singular) ": " $title }} + + {{ if .Paginator.HasPrev }} + + {{ $title = $title | append " - " .Paginator }} + {{ end }} + + {{ $title = $title | append " - " $siteTitle }} + {{ $title = delimit $title "" }} +{{- end -}} + +{{ return $title }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/footer/components/custom-font.html b/themes/hugo-theme-stack/layouts/partials/footer/components/custom-font.html new file mode 100644 index 0000000..8e2ff37 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/footer/components/custom-font.html @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/footer/components/script.html b/themes/hugo-theme-stack/layouts/partials/footer/components/script.html new file mode 100644 index 0000000..3dc96cb --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/footer/components/script.html @@ -0,0 +1,12 @@ +{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}} + +{{- $opts := dict "minify" hugo.IsProduction -}} +{{- $script := resources.Get "ts/main.ts" | js.Build $opts | fingerprint -}} + + + +{{- with resources.Get "ts/custom.ts" -}} + {{/* Place your custom script in HUGO_SITE_FOLDER/assets/ts/custom.ts */}} + {{- $customScript := . | js.Build $opts | fingerprint -}} + +{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/footer/custom.html b/themes/hugo-theme-stack/layouts/partials/footer/custom.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/hugo-theme-stack/layouts/partials/footer/footer.html b/themes/hugo-theme-stack/layouts/partials/footer/footer.html new file mode 100644 index 0000000..9c28779 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/footer/footer.html @@ -0,0 +1,23 @@ +{{- $ThemeVersion := "3.29.0" -}} + diff --git a/themes/hugo-theme-stack/layouts/partials/footer/include.html b/themes/hugo-theme-stack/layouts/partials/footer/include.html new file mode 100644 index 0000000..4b50a88 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/footer/include.html @@ -0,0 +1,3 @@ +{{ partialCached "footer/components/script.html" . }} +{{ partialCached "footer/components/custom-font.html" . }} +{{ partial "footer/custom.html" . }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/head/colorScheme.html b/themes/hugo-theme-stack/layouts/partials/head/colorScheme.html new file mode 100644 index 0000000..42f4dd8 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/head/colorScheme.html @@ -0,0 +1,39 @@ +{{- $defaultColorScheme := default "auto" .Site.Params.colorScheme.default -}} +{{- if not (default false .Site.Params.colorScheme.toggle) -}} + {{/* If toggle is disabled, force default scheme */}} + +{{- else -}} + {{/* Otherwise set to default scheme only if no preference is set by user */}} + +{{- end -}} + + diff --git a/themes/hugo-theme-stack/layouts/partials/head/custom.html b/themes/hugo-theme-stack/layouts/partials/head/custom.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/hugo-theme-stack/layouts/partials/head/head.html b/themes/hugo-theme-stack/layouts/partials/head/head.html new file mode 100644 index 0000000..a7991c1 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/head/head.html @@ -0,0 +1,26 @@ + + + +{{- $description := partialCached "data/description" . .RelPermalink -}} + +{{ with .Params.Keywords }}{{ end }} + +{{- $title := partial "data/title" . -}} +{{ $title }} + + + +{{- partial "head/style.html" . -}} +{{- partial "head/script.html" . -}} +{{- partial "head/opengraph/include.html" . -}} + +{{- range .AlternativeOutputFormats -}} + +{{- end -}} + +{{ with .Site.Params.favicon }} + +{{ end }} + +{{- template "_internal/google_analytics.html" . -}} +{{- partial "head/custom.html" . -}} diff --git a/themes/hugo-theme-stack/layouts/partials/head/opengraph/include.html b/themes/hugo-theme-stack/layouts/partials/head/opengraph/include.html new file mode 100644 index 0000000..3a43f48 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/head/opengraph/include.html @@ -0,0 +1,2 @@ +{{ partial "head/opengraph/provider/base" . }} +{{ partial "head/opengraph/provider/twitter" . }} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/base.html b/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/base.html new file mode 100644 index 0000000..055745d --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/base.html @@ -0,0 +1,43 @@ +{{- $title := partialCached "data/title" . .RelPermalink -}} +{{- $description := partialCached "data/description" . .RelPermalink -}} + + + + + + + +{{- with .Params.locale -}} + +{{- end -}} + +{{- if .IsPage -}} + + {{- range .Params.tags -}} + + {{- end -}} +{{- end -}} + +{{- if .IsPage -}} + {{- if not .Date.IsZero -}} + + {{- end -}} + {{- if not .Lastmod.IsZero -}} + + {{- end -}} +{{- else -}} + {{- if not .Site.Lastmod.IsZero -}} + + {{- end -}} +{{- end -}} + +{{ $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }} +{{- if $image.exists -}} + +{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/twitter.html b/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/twitter.html new file mode 100644 index 0000000..c39eba3 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/head/opengraph/provider/twitter.html @@ -0,0 +1,16 @@ +{{- with .Site.Params.opengraph.twitter.site -}} + + +{{- end -}} + +{{- $title := partialCached "data/title" . .RelPermalink -}} +{{- $description := partialCached "data/description" . .RelPermalink -}} + + + + +{{- $image := partialCached "helper/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" -}} +{{- if $image.exists -}} + + +{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/head/script.html b/themes/hugo-theme-stack/layouts/partials/head/script.html new file mode 100644 index 0000000..e69de29 diff --git a/themes/hugo-theme-stack/layouts/partials/head/style.html b/themes/hugo-theme-stack/layouts/partials/head/style.html new file mode 100644 index 0000000..30ca26e --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/head/style.html @@ -0,0 +1,3 @@ +{{ $sass := resources.Get "scss/style.scss" }} +{{ $style := $sass | toCSS | minify | resources.Fingerprint "sha256" }} + \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/helper/external.html b/themes/hugo-theme-stack/layouts/partials/helper/external.html new file mode 100644 index 0000000..88d9525 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/helper/external.html @@ -0,0 +1,29 @@ +{{- $List := index .Context.Site.Data.external .Namespace -}} +{{- with $List -}} + {{- range . -}} + {{- if eq .type "script" -}} + + {{- else if eq .type "style" -}} + + {{- else -}} + {{- errorf "Error: unknown external resource type: %s" .type -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- errorf "Error: external resource '%s' is not found" .Namespace -}} +{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/helper/icon.html b/themes/hugo-theme-stack/layouts/partials/helper/icon.html new file mode 100644 index 0000000..72162e8 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/helper/icon.html @@ -0,0 +1,6 @@ +{{- $iconFile := resources.GetMatch (printf "icons/%s.svg" .) -}} +{{- if $iconFile -}} + {{- $iconFile.Content | safeHTML -}} +{{- else -}} + {{- errorf "Error: icon '%s.svg' is not found under 'assets/icons' folder" . -}} +{{- end -}} \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/partials/helper/image.html b/themes/hugo-theme-stack/layouts/partials/helper/image.html new file mode 100644 index 0000000..11fc3b6 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/helper/image.html @@ -0,0 +1,61 @@ +{{ $result := dict "exists" false "permalink" nil "resource" nil "isDefault" false }} +{{ $imageField := default "image" .Context.Site.Params.featuredImageField }} +{{ $imageValue := index .Context.Params $imageField }} + +{{ if $imageValue }} + + {{ $result = merge $result (dict "exists" true) }} + {{ $url := urls.Parse $imageValue }} + + {{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }} + + {{ $result = merge $result (dict "permalink" $imageValue) }} + {{ else }} + {{ $pageResourceImage := .Context.Resources.GetMatch (printf "%s" ($imageValue | safeURL)) }} + + {{ if $pageResourceImage }} + + {{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }} + + + {{ if ne (path.Ext $imageValue) ".svg" }} + {{ $result = merge $result (dict "resource" $pageResourceImage) }} + {{ end }} + {{ else }} + + {{ $result = merge $result (dict "permalink" (relURL $imageValue)) }} + {{ end }} + + {{ end }} + +{{ else if and (ne .Type nil) (index .Context.Site.Params.defaultImage .Type) }} + + {{ $defaultImageSetting := index .Context.Site.Params.defaultImage .Type }} + + {{ if $defaultImageSetting.enabled }} + {{ $result = merge $result (dict "isDefault" true) }} + {{ $result = merge $result (dict "exists" true) }} + + {{ if $defaultImageSetting.local }} + {{ $siteResourceImage := resources.GetMatch (printf "%s" ($defaultImageSetting.src | safeURL)) }} + + {{ if $siteResourceImage }} + + {{ $result = merge $result (dict "permalink" $siteResourceImage.RelPermalink) }} + {{ $result = merge $result (dict "resource" $siteResourceImage) }} + {{ else }} + + {{ errorf "Failed loading image: %q" $defaultImageSetting.src }} + {{ $result = merge $result (dict "exists" false) }} + {{ end }} + + {{ else }} + + {{ $result = merge $result (dict "permalink" (relURL $defaultImageSetting.src)) }} + {{ end }} + + {{ end }} + +{{ end }} + +{{ return $result }} diff --git a/themes/hugo-theme-stack/layouts/partials/pagination.html b/themes/hugo-theme-stack/layouts/partials/pagination.html new file mode 100644 index 0000000..7756050 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/pagination.html @@ -0,0 +1,26 @@ +{{ if gt .Paginator.TotalPages 1 }} + +{{ end }} diff --git a/themes/hugo-theme-stack/layouts/partials/sidebar/left.html b/themes/hugo-theme-stack/layouts/partials/sidebar/left.html new file mode 100644 index 0000000..21e7d3e --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/sidebar/left.html @@ -0,0 +1,103 @@ + diff --git a/themes/hugo-theme-stack/layouts/partials/sidebar/right.html b/themes/hugo-theme-stack/layouts/partials/sidebar/right.html new file mode 100644 index 0000000..6333f10 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/partials/sidebar/right.html @@ -0,0 +1,16 @@ +{{- $scope := default "homepage" .Scope -}} +{{- $context := .Context -}} +{{- with (index .Context.Site.Params.widgets $scope) -}} + +{{ end }} \ No newline at end of file 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 diff --git a/themes/hugo-theme-stack/layouts/shortcodes/bilibili.html b/themes/hugo-theme-stack/layouts/shortcodes/bilibili.html new file mode 100644 index 0000000..cb72e43 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/shortcodes/bilibili.html @@ -0,0 +1,23 @@ +{{ $vid := (.Get 0) }} +{{ $videopage := default 1 (.Get 1) }} +{{ $basicQuery := querify "page" $videopage "high_quality" 1 "as_wide" 1 }} +{{ $videoQuery := "" }} + +{{ if strings.HasPrefix (lower $vid) "av" }} + {{ $videoQuery = querify "aid" (strings.TrimPrefix "av" (lower $vid)) }} +{{ else if strings.HasPrefix (lower $vid) "bv" }} + {{ $videoQuery = querify "bvid" $vid }} +{{ else }} +

Bilibili 视频av号或BV号错误!请检查视频av号或BV号是否正确

+

当前视频av或BV号:{{ $vid }},视频分P:{{ $videopage }}

+{{ end }} + +
+ +
diff --git a/themes/hugo-theme-stack/layouts/shortcodes/gitlab.html b/themes/hugo-theme-stack/layouts/shortcodes/gitlab.html new file mode 100644 index 0000000..b5a16cf --- /dev/null +++ b/themes/hugo-theme-stack/layouts/shortcodes/gitlab.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/shortcodes/quote.html b/themes/hugo-theme-stack/layouts/shortcodes/quote.html new file mode 100644 index 0000000..09bb07c --- /dev/null +++ b/themes/hugo-theme-stack/layouts/shortcodes/quote.html @@ -0,0 +1,15 @@ +
+

{{ .Inner | markdownify }}

+ {{- if or (.Get "author") (.Get "source") -}} + + {{- if .Get "author" -}} + + {{- .Get "author" -}}{{- if .Get "source" -}}, {{ end -}} + + {{- end -}} + {{- with .Get "url" -}}{{- end -}} + {{ .Get "source" }} + {{- if .Get "url" -}}{{- end -}} + + {{- end -}} +
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/shortcodes/tencent.html b/themes/hugo-theme-stack/layouts/shortcodes/tencent.html new file mode 100644 index 0000000..463dec5 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/shortcodes/tencent.html @@ -0,0 +1,10 @@ +{{ $vid := .Get 0 }} +
+ +
\ No newline at end of file diff --git a/themes/hugo-theme-stack/layouts/shortcodes/video.html b/themes/hugo-theme-stack/layouts/shortcodes/video.html new file mode 100644 index 0000000..5324754 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/shortcodes/video.html @@ -0,0 +1,14 @@ +{{- $src := .Get "src" | default (.Get 0) -}} +
+ +
diff --git a/themes/hugo-theme-stack/layouts/shortcodes/youtube.html b/themes/hugo-theme-stack/layouts/shortcodes/youtube.html new file mode 100644 index 0000000..2f85931 --- /dev/null +++ b/themes/hugo-theme-stack/layouts/shortcodes/youtube.html @@ -0,0 +1,13 @@ +{{- $pc := .Page.Site.Config.Privacy.YouTube -}} +{{- if not $pc.Disable -}} +{{- $ytHost := cond $pc.PrivacyEnhanced "www.youtube-nocookie.com" "www.youtube.com" -}} +{{- $id := .Get "id" | default (.Get 0) -}} +
+ +
+{{ end -}} \ No newline at end of file -- cgit v1.2.3