aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--assets/_main.scss6
-rw-r--r--layouts/partials/docs/footer.html4
3 files changed, 18 insertions, 0 deletions
diff --git a/README.md b/README.md
index 2fb91ea..bfdba3b 100644
--- a/README.md
+++ b/README.md
@@ -24,6 +24,7 @@
- Customisable
- Zero initial configuration
- Handy shortcodes
+- Optional support for Disqus
## Requirements
@@ -117,6 +118,10 @@ You can also see `yaml` example [here](https://github.com/alex-shpak/hugo-book/b
# Always put it on the top of the configuration file, otherwise it won't work
googleAnalytics = "UA-XXXXXXXXX-X"
+# (Optional) If you provide a Disqus shortname, comments will be enabled on
+# all pages.
+disqusShortname = "my-site"
+
# (Optional) Set this to true if you use capital letters in file names
disablePathToLower = true
@@ -190,6 +195,9 @@ bookHidden = true
# (Optional) Set how many levels of ToC to show. use 'false' to hide ToC completely
bookToC = 3
+
+# If you have enabled Disqus for the site, you can disable it for specific pages.
+bookDisableComments = true
```
### Partials
diff --git a/assets/_main.scss b/assets/_main.scss
index 9553f61..b7a64fc 100644
--- a/assets/_main.scss
+++ b/assets/_main.scss
@@ -235,6 +235,12 @@ ul.pagination {
}
}
+// Give a little extra space before showing Disqus comments. See:
+// https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/disqus.html#L3
+#disqus_thread {
+ padding-top: $padding-16;
+}
+
.book-languages {
position: relative;
overflow: visible;
diff --git a/layouts/partials/docs/footer.html b/layouts/partials/docs/footer.html
index 99d4926..777fd5f 100644
--- a/layouts/partials/docs/footer.html
+++ b/layouts/partials/docs/footer.html
@@ -25,3 +25,7 @@
{{ end }}
</div>
+
+{{ if and (not (eq .Site.DisqusShortname "")) (not .Params.bookDisableComments ) }}
+ {{ template "_internal/disqus.html" . }}
+{{ end }}