diff options
Diffstat (limited to 'themes/CodeIT/layouts/_default')
-rw-r--r-- | themes/CodeIT/layouts/_default/baseof.html | 3 | ||||
-rw-r--r-- | themes/CodeIT/layouts/_default/single.html | 29 |
2 files changed, 31 insertions, 1 deletions
diff --git a/themes/CodeIT/layouts/_default/baseof.html b/themes/CodeIT/layouts/_default/baseof.html index 4303015..804bb28 100644 --- a/themes/CodeIT/layouts/_default/baseof.html +++ b/themes/CodeIT/layouts/_default/baseof.html @@ -18,7 +18,8 @@ <body header-desktop="{{ .Site.Params.header.desktopMode }}" header-mobile="{{ .Site.Params.header.mobileMode }}"> {{- /* Check theme isDark before body rendering */ -}} {{- $theme := .Site.Params.defaulttheme -}} - <script type="text/javascript">(window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script> + {{- $cookieConsentEnabled := .Site.Params.cookieconsent.enable -}} + <script type="text/javascript">('{{ $cookieConsentEnabled }}' === 'true' && window.localStorage && localStorage.getItem('theme') ? localStorage.getItem('theme') === 'dark' : ('{{ $theme }}' === 'auto' ? window.matchMedia('(prefers-color-scheme: dark)').matches : '{{ $theme }}' === 'dark')) && document.body.setAttribute('theme', 'dark');</script> <div id="mask"></div> diff --git a/themes/CodeIT/layouts/_default/single.html b/themes/CodeIT/layouts/_default/single.html index a34e22b..8861185 100644 --- a/themes/CodeIT/layouts/_default/single.html +++ b/themes/CodeIT/layouts/_default/single.html @@ -2,6 +2,22 @@ {{- define "content" -}} {{- $params := .Scratch.Get "params" -}} + + {{- $toc := $params.toc -}} + {{- if eq $toc true -}} + {{- $toc = .Site.Params.page.toc | default dict -}} + {{- else if eq $toc false -}} + {{- $toc = dict "enable" false -}} + {{- end -}} + + {{- /* Auto TOC */ -}} + {{- if ne $toc.enable false -}} + <div class="toc" id="toc-auto"> + <h2 class="toc-title">{{ T "contents" }}</h2> + <div class="toc-content{{ if eq $toc.auto false }} always-active{{ end }}" id="toc-content-auto"></div> + </div> + {{- end -}} + <div class="page single special"> {{- /* Title */ -}} <h1 class="single-title animated pulse faster"> @@ -13,6 +29,19 @@ <h2 class="single-subtitle">{{ . }}</h2> {{- end -}} + {{- /* Static TOC */ -}} + {{- if ne $toc.enable false -}} + <div class="details toc" id="toc-static" kept="{{ if $toc.keepStatic }}true{{ end }}"> + <div class="details-summary toc-title"> + <span>{{ T "contents" }}</span> + <span><i class="details-icon fas fa-angle-right"></i></span> + </div> + <div class="details-content toc-content" id="toc-content-static"> + {{- dict "Content" .TableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} + </div> + </div> + {{- end -}} + {{- /* Content */ -}} <div class="content" id="content"> {{- dict "Content" .Content "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}} |