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

github.com/htr3n/hyde-hyde.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuy Tran <hoang.huy.tran@gmail.com>2018-09-30 04:58:57 +0300
committerHuy Tran <hoang.huy.tran@gmail.com>2018-09-30 04:58:57 +0300
commite785ac36f19a92b30411db8d8abcbd105dd3818c (patch)
tree6b7b58c2a0f3213cb3435dc4e5687e72023e963c
parentb517159c0e584ac67546e40907a883d6af4ff32c (diff)
revises tocbot configuration and documentationv2.0.2
-rw-r--r--CHANGELOG.md3
-rw-r--r--README.md1
-rw-r--r--layouts/partials/page-single/footer.html18
3 files changed, 21 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c9eed5c..2f6926d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,8 +5,9 @@ __2018-09__
* Add _Table of Contents_
* Configure using `.Site.Params.toc` with two possible value: "hugo" (using Hugo `{{ .TableOfContents }}`, and "tocbot" (using [Tocbot](https://tscanlin.github.io/tocbot/)), remove `.Site.Params.toc` to disable TOC
* Change [_layouts/partials/header/styles.html_](https://github.com/htr3n/hyde-hyde/blob/master/layouts/partials/header/styles.html) to check `.Site.Params.toc` and add the corresponding styles
- * Change [_layouts/partials/page-single/content.html_](_layouts/partials/page-single/content.html_ ) to add TOC per `.Site.Params.toc`
+ * Change [_layouts/partials/page-single/content.html_](https://github.com/htr3n/hyde-hyde/blob/master/layouts/partials/page-single/content.html ) to add TOC per `.Site.Params.toc`
* Add styles [_static-src/scss/hugo-toc.scss_](https://github.com/htr3n/hyde-hyde/blob/master/static-src/scss/hugo-toc.scss) and [_static-src/scss/tocbot.scss_](https://github.com/htr3n/hyde-hyde/blob/master/static-src/scss/tocbot.scss) that generate `hugo-toc.css` and `tocbot.css`, respectively
+ * Tocbot can be configured in [_layouts/partials/page-single/footer.html_](_layouts/partials/page-single/footer.html_) with options as described in [its documentation](https://tscanlin.github.io/tocbot/#api)
__2018-07__
diff --git a/README.md b/README.md
index fe2d03e..c291378 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,7 @@ Since version 2.0, __`hyde-hyde`__ has been overhauled and, therefore, might cau
* Experimenting a collapsible menu in mobile mode
* Adding _Table of Contents_
* Configure using `.Site.Params.toc` with two possible value: "hugo" (using Hugo `{{ .TableOfContents }}`, and "tocbot" (using [Tocbot](https://tscanlin.github.io/tocbot/)), remove `.Site.Params.toc` to disable TOC
+ * Tocbot can be configured in [_layouts/partials/page-single/footer.html_](_layouts/partials/page-single/footer.html_) with options as described in [its documentation](https://tscanlin.github.io/tocbot/#api)
For more details, please refer to [CHANGELOG](https://github.com/htr3n/hyde-hyde/blob/master/CHANGELOG.md). A real site in action can be found [here](https://htr3n.github.io) and its [WIP source](https://github.com/htr3n/htr3n-blog) for reference.
diff --git a/layouts/partials/page-single/footer.html b/layouts/partials/page-single/footer.html
index 4cad938..392ddc8 100644
--- a/layouts/partials/page-single/footer.html
+++ b/layouts/partials/page-single/footer.html
@@ -4,3 +4,21 @@
{{ end }}
{{ partial "footer/font-awesome-js.html" . }}
{{ partial "highlight-js.html" . }}
+{{ with .Site.Params.toc }}
+{{ if eq . "tocbot" }}
+<script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.1.1/tocbot.js"></script>
+<script type="text/javascript">
+ if (tocbot) {
+ tocbot.init({
+ // Where to render the table of contents.
+ tocSelector: '.toc',
+ // Where to grab the headings to build the table of contents.
+ contentSelector: '.post',
+ // Which headings to grab inside of the contentSelector element.
+ headingSelector: 'h2, h3, h4',
+ collapseDepth: 4
+ });
+ }
+</script>
+{{ end }}
+{{ end }}