mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
48 lines
1.5 KiB
HTML
48 lines
1.5 KiB
HTML
{{ define "body-class" }}
|
|
{{- .Scratch.Set "hasTOC" (ge (len .TableOfContents) 100) -}}
|
|
article-page keep-sidebar{{ if (.Scratch.Get "hasTOC") }} has-toc{{ end }}
|
|
{{ end }}
|
|
{{ define "container-class" }}extended{{ end }}
|
|
{{ define "main" }}
|
|
{{ partial "article/article.html" . }}
|
|
|
|
{{ partial "article/components/related-contents" . }}
|
|
|
|
{{ if or (not (isset .Params "comments")) (eq .Params.comments "true")}}
|
|
{{ 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 }}" class="back-home">
|
|
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
|
|
<span>Back</span>
|
|
</a>
|
|
</div>
|
|
{{ else }}
|
|
{{ partial "sidebar/left.html" . }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
{{ define "right-sidebar" }}
|
|
{{ if (.Scratch.Get "hasTOC") }}
|
|
<aside class="sidebar right-sidebar sticky">
|
|
<section class="widget archives">
|
|
<div class="widget-icon">
|
|
{{ partial "helper/icon" "hash" }}
|
|
</div>
|
|
<h2 class="widget-title section-title">Table of contents</h2>
|
|
|
|
<div class="widget--toc">
|
|
{{ .TableOfContents }}
|
|
</div>
|
|
</section>
|
|
</aside>
|
|
{{ end }}
|
|
{{ end }} |