feat: added support for Disqus (#120)
* feat: added support for Disqus * feat: allow disqus to be disabled through frontmatter Set: bookDisableComments: true On a page to disable disqus for the content.
This commit is contained in:
parent
e037b7c70f
commit
36a8cf5169
3 changed files with 18 additions and 0 deletions
|
@ -24,6 +24,7 @@
|
||||||
- Customisable
|
- Customisable
|
||||||
- Zero initial configuration
|
- Zero initial configuration
|
||||||
- Handy shortcodes
|
- Handy shortcodes
|
||||||
|
- Optional support for Disqus
|
||||||
|
|
||||||
## Requirements
|
## 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
|
# Always put it on the top of the configuration file, otherwise it won't work
|
||||||
googleAnalytics = "UA-XXXXXXXXX-X"
|
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
|
# (Optional) Set this to true if you use capital letters in file names
|
||||||
disablePathToLower = true
|
disablePathToLower = true
|
||||||
|
|
||||||
|
@ -190,6 +195,9 @@ bookHidden = true
|
||||||
|
|
||||||
# (Optional) Set how many levels of ToC to show. use 'false' to hide ToC completely
|
# (Optional) Set how many levels of ToC to show. use 'false' to hide ToC completely
|
||||||
bookToC = 3
|
bookToC = 3
|
||||||
|
|
||||||
|
# If you have enabled Disqus for the site, you can disable it for specific pages.
|
||||||
|
bookDisableComments = true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Partials
|
### Partials
|
||||||
|
|
|
@ -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 {
|
.book-languages {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
|
|
|
@ -25,3 +25,7 @@
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ if and (not (eq .Site.DisqusShortname "")) (not .Params.bookDisableComments ) }}
|
||||||
|
{{ template "_internal/disqus.html" . }}
|
||||||
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue