mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 03:53:30 +08:00
fix: set scratch inside define block
This commit is contained in:
parent
b5bcc24ca2
commit
09fac88cb5
@ -1,5 +1,7 @@
|
||||
{{ .Scratch.Set "hasTOC" (ge (len .TableOfContents) 100) }}
|
||||
{{ define "body-class" }}article-page keep-sidebar{{ if .Scratch.Get "hasTOC" }} has-toc{{ end }}{{ end }}
|
||||
{{ 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" . }}
|
||||
@ -16,7 +18,7 @@
|
||||
{{ end }}
|
||||
|
||||
{{ define "left-sidebar" }}
|
||||
{{ if .Scratch.Get "hasTOC" }}
|
||||
{{ if (.Scratch.Get "hasTOC") }}
|
||||
<div id="article-toolbar">
|
||||
<a href="{{ .Site.BaseURL }}" class="back-home">
|
||||
{{ (resources.Get "icons/back.svg").Content | safeHTML }}
|
||||
@ -29,7 +31,7 @@
|
||||
{{ end }}
|
||||
|
||||
{{ define "right-sidebar" }}
|
||||
{{ if .Scratch.Get "hasTOC" }}
|
||||
{{ if (.Scratch.Get "hasTOC") }}
|
||||
<aside class="sidebar right-sidebar sticky">
|
||||
<section class="widget archives">
|
||||
<div class="widget-icon">
|
||||
|
Loading…
Reference in New Issue
Block a user