2021-06-22 00:44:54 +08:00
|
|
|
{{ define "body-class" }}
|
2022-02-27 06:45:25 +08:00
|
|
|
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)) -}}
|
2021-06-22 00:44:54 +08:00
|
|
|
{{ end }}
|
|
|
|
|
2020-08-22 19:20:08 +08:00
|
|
|
{{ define "main" }}
|
2020-09-12 16:33:53 +08:00
|
|
|
{{ partial "article/article.html" . }}
|
2020-08-22 19:20:08 +08:00
|
|
|
|
2021-12-28 18:28:20 +08:00
|
|
|
{{ if .Params.links }}
|
|
|
|
{{ partial "article/components/links" . }}
|
|
|
|
{{ end }}
|
|
|
|
|
2021-06-22 00:44:54 +08:00
|
|
|
{{ partial "article/components/related-contents" . }}
|
|
|
|
|
2021-09-18 03:29:19 +08:00
|
|
|
{{ if not (eq .Params.comments false) }}
|
2020-09-12 16:33:53 +08:00
|
|
|
{{ partial "comments/include" . }}
|
|
|
|
{{ end }}
|
2020-08-22 19:20:08 +08:00
|
|
|
|
2020-09-12 16:33:53 +08:00
|
|
|
{{ partialCached "footer/footer" . }}
|
2020-08-22 19:20:08 +08:00
|
|
|
|
2020-09-18 03:46:48 +08:00
|
|
|
{{ partialCached "article/components/photoswipe" . }}
|
2021-06-22 00:44:54 +08:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ define "right-sidebar" }}
|
2022-02-27 06:45:25 +08:00
|
|
|
{{ if .Scratch.Get "hasWidget" }}{{ partial "sidebar/right.html" (dict "Context" . "Scope" "page") }}{{ end}}
|
2021-09-18 03:29:19 +08:00
|
|
|
{{ end }}
|