Welcome to mirror list, hosted at ThFree Co, Russian Federation.

single.html « _default « layouts - github.com/CaiJimmy/hugo-theme-stack.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 040b54702d1a7b25bf7919be3dfbaee61e320647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
{{ 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" . }}

    {{ 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>{{ T "article.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">{{ T "article.tableOfContents" }}</h2>
                
                <div class="widget--toc">
                    {{ .TableOfContents }}
                </div>
            </section>
        </aside>
    {{ end }}
{{ end }}