diff --git a/exampleSite/config/_default/config.toml b/exampleSite/config/_default/config.toml
index 3dcac10d..fc887066 100644
--- a/exampleSite/config/_default/config.toml
+++ b/exampleSite/config/_default/config.toml
@@ -18,9 +18,6 @@ copyright = ""
# Enable analytics by entering your Google Analytics tracking ID
googleAnalytics = ""
-# Enable comments by entering your Disqus shortname
-disqusShortname = ""
-
############################
## Advanced options below ##
############################
diff --git a/exampleSite/config/_default/params.toml b/exampleSite/config/_default/params.toml
index c6ed77f4..bc21a1d7 100644
--- a/exampleSite/config/_default/params.toml
+++ b/exampleSite/config/_default/params.toml
@@ -45,7 +45,7 @@ privacy_pack = false
# Enable visitors to edit pages?
# `repo` defines the repository URL. `editable` defines which page types can be edited.
-edit_page = {repo_url = "https://github.com/gcushen/hugo-academic", editable = {docs = true}}
+edit_page = {repo_url = "https://github.com/gcushen/hugo-academic", editable = {docs = true, page = false, post = false}}
# Date and time format (refer to https://sourcethemes.com/academic/docs/customization/#date-format )
# Examples: "Mon, Jan 2, 2006" or "2006-01-02"
@@ -123,9 +123,6 @@ menu_align_right = false
# Show estimated reading time for posts? (true/false)
reading_time = true
-# Display comment count (if commenting enabled in config.toml)? (true/false)
-comment_count = true
-
# Display next/previous section pager? (true/false)
section_pager = false
docs_section_pager = true # Display pager in Docs layout (e.g. tutorials)?
@@ -153,6 +150,22 @@ sharing = true
publication_view = 2
talk_view = 2
+# Comments.
+[comments]
+ # Comment provider:
+ # 0: Disabled
+ # 1: Disqus (https://disqus.com)
+ # 2: Commento (https://commento.io)
+ engine = 0
+
+ # Which page types are commentable?
+ commentable = {page = true, post = true, docs = true}
+
+ # Configuration of Disqus.
+ [comments.disqus]
+ shortname = "" # Paste the shortname from your Disqus dashboard.
+ show_count = true # Show comment count in page header? (true/false)
+
# Search.
[search]
# Search provider:
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index db72d11e..8e8e54de 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -2,7 +2,7 @@
- {{ partial "page_header.html" . }}
+ {{ partial "page_header" . }}
@@ -10,10 +10,12 @@
{{ .Content }}
- {{ partial "tags.html" . }}
+ {{ partial "edit_page" . }}
+
+ {{ partial "tags" . }}
{{ if ne .Type "page" }}
- {{ partial "page_author.html" . }}
+ {{ partial "page_author" . }}
{{ $related := site.RegularPages.Related . | first 5 }}
{{ with $related }}
@@ -30,11 +32,11 @@
{{ if site.Params.section_pager }}
- {{ partial "section_pager.html" . }}
+ {{ partial "section_pager" . }}
{{ end }}
- {{ partial "comments.html" . }}
+ {{ partial "comments" . }}
diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html
index 977ec849..53fb4978 100644
--- a/layouts/partials/comments.html
+++ b/layouts/partials/comments.html
@@ -1,5 +1,9 @@
-{{ if and site.DisqusShortname (not (or site.Params.disable_comments .Params.disable_comments)) }}
+{{ if site.Params.comments.engine | and (index site.Params.comments.commentable .Type) | and (ne .Params.commentable false) | or .Params.commentable }}
{{ end }}
diff --git a/layouts/partials/comments/commento.html b/layouts/partials/comments/commento.html
new file mode 100644
index 00000000..8d9a1975
--- /dev/null
+++ b/layouts/partials/comments/commento.html
@@ -0,0 +1,2 @@
+
+
diff --git a/layouts/partials/comments/disqus.html b/layouts/partials/comments/disqus.html
new file mode 100644
index 00000000..58cdbf4a
--- /dev/null
+++ b/layouts/partials/comments/disqus.html
@@ -0,0 +1,22 @@
+{{ if site.Params.comments.disqus.shortname }}
+
+
+
+comments powered by
+{{end}}
diff --git a/layouts/partials/docs_layout.html b/layouts/partials/docs_layout.html
index 924fb8b2..5ad3d382 100644
--- a/layouts/partials/docs_layout.html
+++ b/layouts/partials/docs_layout.html
@@ -41,13 +41,9 @@
{{ i18n "last_updated" }} {{ $.Lastmod.Format site.Params.date_format }}
- {{ if site.Params.edit_page.repo_url | and site.Params.edit_page.editable.docs | and (ne .Params.editable false) | or .Params.editable }}
-
-
- {{ i18n "edit_page" | default "Edit this page" }}
-
-
- {{ end }}
+ {{ partial "edit_page" . }}
+
+ {{ partial "comments" . }}
diff --git a/layouts/partials/edit_page.html b/layouts/partials/edit_page.html
new file mode 100644
index 00000000..6a55528e
--- /dev/null
+++ b/layouts/partials/edit_page.html
@@ -0,0 +1,7 @@
+{{ if site.Params.edit_page.repo_url | and (index site.Params.edit_page.editable .Type) | and (ne .Params.editable false) | or .Params.editable }}
+
+
+ {{ i18n "edit_page" | default "Edit this page" }}
+
+
+{{ end }}
diff --git a/layouts/partials/page_metadata.html b/layouts/partials/page_metadata.html
index 21241a2e..3e2522ee 100644
--- a/layouts/partials/page_metadata.html
+++ b/layouts/partials/page_metadata.html
@@ -49,10 +49,12 @@
{{ end }}
- {{ $comments_enabled := and site.DisqusShortname (in (slice "post" "page") $page.Type) (not (or site.Params.disable_comments (eq $page.Params.comments false))) }}
- {{ if and $comments_enabled (site.Params.comment_count | default true) }}
+ {{/* Show Disqus comment count if enabled. */}}
+ {{ $disqus_enabled := eq site.Params.comments.engine 1 | and (index site.Params.comments.commentable $page.Type) | and (ne $page.Params.commentable false) | or $page.Params.commentable }}
+ {{ if and $disqus_enabled (site.Params.comments.disqus.show_count | default true) }}
+
{{ end}}
{{ $taxonomy := "categories" }}
diff --git a/layouts/partials/site_js.html b/layouts/partials/site_js.html
index 3bf2cd54..561b00a9 100644
--- a/layouts/partials/site_js.html
+++ b/layouts/partials/site_js.html
@@ -44,12 +44,6 @@
{{ printf "" (printf $js.leaflet.url $js.leaflet.version) $js.leaflet.sri | safeHTML }}
{{ end }}
- {{/* Comments JS. */}}
- {{ $comments_enabled := and site.DisqusShortname (not (or site.Params.disable_comments $.Params.disable_comments)) }}
- {{ if and $comments_enabled (site.Params.comment_count | default true) }}
-
- {{ end }}
-
{{/* Initialise code highlighting. */}}
{{ if $.Scratch.Get "highlight_enabled" }}