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

toc.html « partials « layouts - github.com/wlh320/hugo-theme-hulga.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2a5c87cc5e16a48cbbf0baa31cb8147ef274b3e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{{ $options := (dict "outputStyle" "compressed" "includePaths" (slice "sass")) }}
{{ $tocScss := resources.Get "css/toc.scss" }}
{{ $toc := $tocScss | resources.ExecuteAsTemplate "css/toc.scss" . | resources.ToCSS $options | resources.Minify }}
<link rel="stylesheet" type="text/css" href="{{ $toc.Permalink | relURL }}">
<script src="/js/tocbot.min.js"></script>
{{ $globalAutoCollapseToc := .Site.Params.autoCollapseToc | default false }}
<script>
    tocbot.init({
        // Where to render the table of contents.
        tocSelector: '.post-toc',
        // Where to grab the headings to build the table of contents.
        contentSelector: '#post-content',
        // Which headings to grab inside of the contentSelector element.
        headingSelector: 'h1, h2, h3',
        collapseDepth: {{ if not (or .Params.autoCollapseToc (and $globalAutoCollapseToc (ne .Params.autoCollapseToc false))) }} 6 {{else}} 0 {{ end }},
        scrollSmooth: true,
        positionFixedSelector: '.post-toc',
        // FIXME: elements in container's offsetTop is not right...It's to difficult for me...
        // fixedSidebarOffset: 'auto',
        fixedSidebarOffset: 273,
    });
</script>