mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-06-18 20:13:31 +08:00
49 lines
1.4 KiB
HTML
49 lines
1.4 KiB
HTML
{{ define "body-class" }}
|
|
{{ $TOCEnabled := default (default false .Site.Params.article.toc) .Params.toc }}
|
|
{{- .Scratch.Set "hasTOC" (and (ge (len .TableOfContents) 100) $TOCEnabled) -}}
|
|
article-page {{ if (.Scratch.Get "hasTOC") }}has-toc{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "container-class" }}
|
|
{{ if (.Scratch.Get "hasTOC") }}
|
|
extended
|
|
{{ else }}
|
|
on-phone--column {{ if .Site.Params.widgets.enabled }}extended{{ else }}compact{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "main" }}
|
|
{{ partial "article/article.html" . }}
|
|
|
|
{{ if .Params.links }}
|
|
{{ partial "article/components/links" . }}
|
|
{{ end }}
|
|
|
|
{{ partial "article/components/related-contents" . }}
|
|
|
|
{{ if not (eq .Params.comments false) }}
|
|
{{ partial "comments/include" . }}
|
|
{{ end }}
|
|
|
|
{{ partialCached "footer/footer" . }}
|
|
|
|
{{ partialCached "article/components/photoswipe" . }}
|
|
{{ end }}
|
|
|
|
{{ define "left-sidebar" }}
|
|
{{ if (.Scratch.Get "hasTOC") }}
|
|
<div id="article-toolbar">
|
|
<a href="{{ .Site.BaseURL | relLangURL }}" class="back-home">
|
|
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
|
|
<span>{{ T "article.back" }}</span>
|
|
</a>
|
|
</div>
|
|
{{ else }}
|
|
{{ partial "sidebar/left.html" . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "right-sidebar" }}
|
|
{{ partial "sidebar/right.html" (dict "Context" . "Scope" "page") }}
|
|
{{ end }}
|