aboutsummaryrefslogtreecommitdiff
path: root/themes/hugo-theme-stack/layouts/_default/single.html
diff options
context:
space:
mode:
authorAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-11-03 20:08:36 +0300
committerAlexander Neonxp Kiryukhin <i@neonxp.ru>2024-11-03 20:08:36 +0300
commit59c7d4567380d1a9c80e96eb958fdbdd512ce006 (patch)
tree65410cfc10dbc7d060ec23be110662d9b7f6b0e9 /themes/hugo-theme-stack/layouts/_default/single.html
новая жизнь блога
Diffstat (limited to 'themes/hugo-theme-stack/layouts/_default/single.html')
-rw-r--r--themes/hugo-theme-stack/layouts/_default/single.html46
1 files changed, 46 insertions, 0 deletions
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 }}