Skip to content

Commit

Permalink
#133, move disqus to separate template to allow override, rename Book…
Browse files Browse the repository at this point in the history
…Disqus to BookComments
  • Loading branch information
alex-shpak committed Jan 17, 2020
1 parent b9688d7 commit 4b641b0
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,11 @@ disableKinds = ['taxonomy', 'taxonomyTerm']
# Index is built on fly, therefore it might slowdown your website.
BookSearch = true

# (Optional, default true) Enables disqus template on pages
# (Optional, default true) Enables comments template on pages
# By default partals/docs/comments.html includes Disqus template
# See https://gohugo.io/content-management/comments/#configure-disqus
# Can be overwritten by same param in page frontmatter
BookDisqus = true
BookComments = true
```

### Multi-Language Support
Expand Down Expand Up @@ -201,8 +202,8 @@ bookHidden = true
# (Optional) Set how many levels of ToC to show. use 'false' to hide ToC completely
bookToC = 3

# (Optional) If you have enabled Disqus for the site, you can disable it for specific pages.
bookDisqus = true
# (Optional) If you have enabled BookComments for the site, you can disable it for specific pages.
bookComments = true
```

### Partials
Expand Down
6 changes: 2 additions & 4 deletions assets/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,8 @@ 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-comments {
margin-top: $padding-16;
}

.book-languages {
Expand Down
5 changes: 3 additions & 2 deletions exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ enableGitInfo = true
# Index is built on fly, therefore it might slowdown your website.
BookSearch = true

# (Optional, default true) Enables disqus template on pages
# (Optional, default true) Enables comments template on pages
# By default partals/docs/comments.html includes Disqus template
# See https://gohugo.io/content-management/comments/#configure-disqus
# Can be overwritten by same param in page frontmatter
BookDisqus = true
BookComments = true
5 changes: 3 additions & 2 deletions exampleSite/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ params:
# Index is built on fly, therefore it might slowdown your website.
BookSearch: true

# (Optional, default true) Enables disqus template on pages
# (Optional, default true) Enables comments template on pages
# By default partals/docs/comments.html includes Disqus template
# See https://gohugo.io/content-management/comments/#configure-disqus
# Can be overwritten by same param in page frontmatter
BookDisqus: true
BookComments: true

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Target":"book.min.55920954286c88383b10fdedb2b7a929f7806a705625186b14fa1df9056a8b1c.css","MediaType":"text/css","Data":{"Integrity":"sha256-VZIJVChsiDg7EP3tsrepKfeAanBWJRhrFPod+QVqixw="}}
{"Target":"book.min.327a7346ed65bd45e7889adff447f01f212a1b54dbf3c12139d26b63b077108f.css","MediaType":"text/css","Data":{"Integrity":"sha256-MnpzRu1lvUXniJrf9EfwHyEqG1Tb88EhOdJrY7B3EI8="}}
2 changes: 2 additions & 0 deletions layouts/partials/docs/comments.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<!-- This partial can be replaced to support other commenting engines -->
{{ template "_internal/disqus.html" . }}
6 changes: 4 additions & 2 deletions layouts/partials/docs/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

</div>

{{ if (default true (default .Site.Params.BookDisqus .Params.bookDisqus)) }}
{{ template "_internal/disqus.html" . }}
{{ if (default true (default .Site.Params.BookComments .Params.bookComments)) }}
<div class="book-comments">
{{ partial "docs/comments" . }}
</div>
{{ end }}

0 comments on commit 4b641b0

Please sign in to comment.