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

github.com/wlh320/hugo-theme-hulga.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/toc.html')
-rw-r--r--layouts/partials/toc.html22
1 files changed, 22 insertions, 0 deletions
diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html
new file mode 100644
index 0000000..2a5c87c
--- /dev/null
+++ b/layouts/partials/toc.html
@@ -0,0 +1,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>