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

github.com/curttimson/hugo-theme-dopetrope.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCurtis Timson <curt@live.co.uk>2018-02-11 17:12:53 +0300
committerGitHub <noreply@github.com>2018-02-11 17:12:53 +0300
commit03acfe7c59126a725f3ed50eb106107f2ff1c108 (patch)
treeba4df3afb2a81fbc928346f3026f28c2efc5f634
parentfbab234e878457bddf431593f1d8ab8656673a84 (diff)
parentf7c0372e2bc08ee59ef86ecc53ca588800d6b06d (diff)
Merge pull request #19 from curttimson/feature/comments
Feature/comments
-rw-r--r--README.md17
-rw-r--r--exampleSite/config-prod.toml3
-rw-r--r--exampleSite/config.toml3
-rw-r--r--exampleSite/content/post/01-post.md1
-rw-r--r--exampleSite/content/post/02-post.md1
-rw-r--r--exampleSite/content/post/03-post.md1
-rw-r--r--exampleSite/content/post/04-post.md1
-rw-r--r--exampleSite/content/post/05-no-comments.md11
-rw-r--r--exampleSite/content/post/05-post.md11
-rw-r--r--exampleSite/content/post/06-post.md1
-rw-r--r--layouts/_default/single.html42
-rw-r--r--layouts/index.html5
-rw-r--r--layouts/partials/blog.html5
-rw-r--r--layouts/partials/scripts/disqus.html19
-rw-r--r--layouts/partials/scripts/googleanalytics.html11
-rw-r--r--layouts/partials/scripts/index.html (renamed from layouts/partials/scripts.html)17
-rw-r--r--layouts/partials/scripts/scriptscustom.html (renamed from layouts/partials/scriptscustom.html)0
-rw-r--r--package.json2
18 files changed, 100 insertions, 51 deletions
diff --git a/README.md b/README.md
index 942f862..1a03c13 100644
--- a/README.md
+++ b/README.md
@@ -21,6 +21,23 @@ See the demo's configuration as an example:
https://github.com/curttimson/hugo-theme-dopetrope/blob/master/exampleSite/config-prod.toml
+### Blog Comments
+
+Blog comments are supported by Disqus. Once set up comments will be displayed on the blog posts as well as a count on the homepage.
+
+If not set up already, create a Disqus account and enter the account name in the `config.toml` file:
+
+```
+[params.settings]
+ disqus = "hugo-dopetrope"
+```
+
+To display comments on a post a unique ID will need to be added to the specific blog posts. Enter these IDs in the front-matter of the post files themselves:
+
+```
+disqusid = "1"
+```
+
### Cover Image
The cover image URL is hard-coded, therefore to replace this add an image to the following location in your Hugo application:
diff --git a/exampleSite/config-prod.toml b/exampleSite/config-prod.toml
index 8345c70..dc8ef03 100644
--- a/exampleSite/config-prod.toml
+++ b/exampleSite/config-prod.toml
@@ -57,4 +57,5 @@ theme = "../.."
phone = "(800) 000-0000"
[params.settings]
- googleanalytics = "UA-113904582-2" \ No newline at end of file
+ googleanalytics = "UA-113904582-2"
+ disqus = "hugo-dopetrope" \ No newline at end of file
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 6b2852d..1e6fa58 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -57,4 +57,5 @@ theme = "../.."
phone = "(800) 000-0000"
[params.settings]
- googleanalytics = "UA-113904582-1" \ No newline at end of file
+ googleanalytics = "UA-113904582-1"
+ disqus = "hugo-dopetrope" \ No newline at end of file
diff --git a/exampleSite/content/post/01-post.md b/exampleSite/content/post/01-post.md
index 924af3d..c500d72 100644
--- a/exampleSite/content/post/01-post.md
+++ b/exampleSite/content/post/01-post.md
@@ -7,6 +7,7 @@ title = "First post"
slug = "first-post"
author = "John Smith"
draft = false
+disqusid = "1"
+++
Vestibulum scelerisque ultricies libero id hendrerit. Vivamus malesuada quam faucibus ante dignissim auctor hendrerit libero placerat. Nulla facilisi. Proin aliquam felis non arcu molestie at accumsan turpis commodo. Proin elementum, nibh non egestas sodales, augue quam aliquet est, id egestas diam justo adipiscing ante. Pellentesque tempus nulla non urna eleifend ut ultrices nisi faucibus. Vestibulum scelerisque ultricies libero id hendrerit. Vivamus malesuada quam faucibus ante dignissim auctor hendrerit libero placerat. Nulla facilisi. Proin aliquam felis non arcu molestie at accumsan turpis commodo. Proin elementum, nibh non egestas sodales, augue quam aliquet est, id egestas diam justo adipiscing ante.
diff --git a/exampleSite/content/post/02-post.md b/exampleSite/content/post/02-post.md
index 62ab4a5..e97ceed 100644
--- a/exampleSite/content/post/02-post.md
+++ b/exampleSite/content/post/02-post.md
@@ -7,5 +7,6 @@ title = "Second post"
slug = "second-post"
author = "John Smith"
draft = false
+disqusid = "2"
+++
Testing content \ No newline at end of file
diff --git a/exampleSite/content/post/03-post.md b/exampleSite/content/post/03-post.md
index 9b9344a..69a7011 100644
--- a/exampleSite/content/post/03-post.md
+++ b/exampleSite/content/post/03-post.md
@@ -7,5 +7,6 @@ title = "Third post"
slug = "third-post"
author = "John Smith"
draft = false
+disqusid = "3"
+++
Testing content \ No newline at end of file
diff --git a/exampleSite/content/post/04-post.md b/exampleSite/content/post/04-post.md
index c4c1646..dc3eb11 100644
--- a/exampleSite/content/post/04-post.md
+++ b/exampleSite/content/post/04-post.md
@@ -7,5 +7,6 @@ title = "fourth post"
slug = "fourth-post"
author = "John Smith"
draft = false
+disqusid = "4"
+++
Testing content \ No newline at end of file
diff --git a/exampleSite/content/post/05-no-comments.md b/exampleSite/content/post/05-no-comments.md
new file mode 100644
index 0000000..398d076
--- /dev/null
+++ b/exampleSite/content/post/05-no-comments.md
@@ -0,0 +1,11 @@
++++
+description = "An example of a blog post where comments are not allowed"
+date = "2018-01-05T00:00:00"
+thumbnail = "images/pic08.jpg"
+image = "images/pic01.jpg"
+title = "No Comments Allowed"
+slug = "no-comments-allowed"
+author = "John Smith"
+draft = false
++++
+This is an example of a blog post where comments are not allowed. \ No newline at end of file
diff --git a/exampleSite/content/post/05-post.md b/exampleSite/content/post/05-post.md
deleted file mode 100644
index 6af0401..0000000
--- a/exampleSite/content/post/05-post.md
+++ /dev/null
@@ -1,11 +0,0 @@
-+++
-description = "Fifth post description"
-date = "2018-01-05T00:00:00"
-thumbnail = "images/pic08.jpg"
-image = "images/pic01.jpg"
-title = "Fifth post"
-slug = "fifth-post"
-author = "John Smith"
-draft = false
-+++
-Testing content \ No newline at end of file
diff --git a/exampleSite/content/post/06-post.md b/exampleSite/content/post/06-post.md
index 8622f10..3231657 100644
--- a/exampleSite/content/post/06-post.md
+++ b/exampleSite/content/post/06-post.md
@@ -7,5 +7,6 @@ title = "Sixth post"
slug = "sixth-post"
author = "John Smith"
draft = false
+disqusid = "6"
+++
Testing content \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 6453f9a..93054e3 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -15,7 +15,6 @@
<div id="header">
{{ partial "logo.html" . }}
-
{{ partial "nav.html" . }}
</div>
@@ -23,31 +22,32 @@
<!-- Main -->
<div id="main-wrapper">
- <div class="container">
-
- <!-- Content -->
- <article class="box post">
- <a href="#" class="image featured"><img src="{{ .Site.BaseURL }}{{ .Params.image }}" alt="" /></a>
- <header>
- <h2>{{ .Title }}</h2>
- {{ if not .Date.IsZero }}
- <p>Posted {{ .Date.Format "2 Jan 2006" }}</p>
- {{ end }}
- </header>
- {{ .Content }}
- </article>
-
-
-
- </div>
- </div>
+ <div class="container">
+
+ <!-- Content -->
+ <article class="box post">
+ <a href="#" class="image featured"><img src="{{ .Site.BaseURL }}{{ .Params.image }}" alt="" /></a>
+ <header>
+ <h2>{{ .Title }}</h2>
+ {{ if not .Date.IsZero }}
+ <p>Posted {{ .Date.Format "2 Jan 2006" }}</p>
+ {{ end }}
+ </header>
+ {{ .Content }}
+ </article>
+
+ {{ if .Params.disqusid }}
+ <div id="disqus_thread"></div>
+ {{ end }}
+ </div>
+ </div>
- {{ partial "footer/index.html" . }}
+ {{ partial "footer/index.html" . }}
</div>
- {{ partial "scripts.html" . }}
+ {{ partial "scripts/index.html" . }}
</body>
</html>
diff --git a/layouts/index.html b/layouts/index.html
index 7271806..8195272 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -49,7 +49,10 @@
</div>
- {{ partial "scripts.html" . }}
+ {{ partial "scripts/index.html" . }}
+ {{ if .Site.Params.Settings.disqus }}
+ <script id="dsq-count-scr" src="//{{ .Site.Params.Settings.disqus }}.disqus.com/count.js" async></script>
+ {{ end }}
</body>
</html>
diff --git a/layouts/partials/blog.html b/layouts/partials/blog.html
index d7feb25..693d815 100644
--- a/layouts/partials/blog.html
+++ b/layouts/partials/blog.html
@@ -16,8 +16,11 @@
<footer>
<ul class="actions">
<li><a href="{{ .Permalink }}" class="button icon fa-file-text">Continue Reading</a></li>
- <!-- <li><a href="#" class="button alt icon fa-comment">33 comments</a></li> -->
+ {{ if and (.Site.Params.Settings.disqus) (.Params.disqusid) }}
+ <li><a href="{{ .Permalink }}" class="button alt icon fa-comment disqus-comment-count" data-disqus-identifier="{{ .Params.disqusid }}">0 Comments</a></li>
+ {{ end }}
</ul>
+ <span class="" ></span>
</footer>
</section>
</div>
diff --git a/layouts/partials/scripts/disqus.html b/layouts/partials/scripts/disqus.html
new file mode 100644
index 0000000..f698609
--- /dev/null
+++ b/layouts/partials/scripts/disqus.html
@@ -0,0 +1,19 @@
+{{ if and (.Site.Params.Settings.disqus) (.Params.disqusid) }}
+<script>
+ /**
+ * RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
+ * LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
+
+ var disqus_config = function () {
+ this.page.url = {{ .Permalink }}; // Replace PAGE_URL with your page's canonical URL variable
+ this.page.identifier = {{ .Params.disqusid }}; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
+ };
+
+ (function() { // DON'T EDIT BELOW THIS LINE
+ var d = document, s = d.createElement('script');
+ s.src = 'https://{{ .Site.Params.Settings.disqus }}.disqus.com/embed.js';
+ s.setAttribute('data-timestamp', +new Date());
+ (d.head || d.body).appendChild(s);
+ })();
+ </script>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/scripts/googleanalytics.html b/layouts/partials/scripts/googleanalytics.html
new file mode 100644
index 0000000..98a3c47
--- /dev/null
+++ b/layouts/partials/scripts/googleanalytics.html
@@ -0,0 +1,11 @@
+{{ if .Site.Params.Settings.googleanalytics }}
+<!-- Global site tag (gtag.js) - Google Analytics -->
+<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113904582-1"></script>
+<script>
+ window.dataLayer = window.dataLayer || [];
+ function gtag(){dataLayer.push(arguments);}
+ gtag('js', new Date());
+
+ gtag('config', {{ .Site.Params.Settings.googleanalytics }});
+</script>
+{{ end }} \ No newline at end of file
diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts/index.html
index 8eb56ab..373b5d4 100644
--- a/layouts/partials/scripts.html
+++ b/layouts/partials/scripts/index.html
@@ -7,17 +7,6 @@
<!--[if lte IE 8]><script src="{{ .Site.BaseURL }}assets/js/ie/respond.min.js"></script><![endif]-->
<script src="{{ .Site.BaseURL }}assets/js/main.js"></script>
-{{ if .Site.Params.Settings.googleanalytics }}
-<!-- Global site tag (gtag.js) - Google Analytics -->
-<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113904582-1"></script>
-<script>
- window.dataLayer = window.dataLayer || [];
- function gtag(){dataLayer.push(arguments);}
- gtag('js', new Date());
-
- gtag('config', {{ .Site.Params.Settings.googleanalytics }});
-</script>
-
-{{ end }}
-
-{{ partial "scriptscustom.html" . }} \ No newline at end of file
+{{ partial "scripts/googleanalytics.html" . }}
+{{ partial "scripts/disqus.html" . }}
+{{ partial "scripts/scriptscustom.html" . }} \ No newline at end of file
diff --git a/layouts/partials/scriptscustom.html b/layouts/partials/scripts/scriptscustom.html
index e69de29..e69de29 100644
--- a/layouts/partials/scriptscustom.html
+++ b/layouts/partials/scripts/scriptscustom.html
diff --git a/package.json b/package.json
index 8dde085..2b342a9 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "hugo-theme-dopetrope",
- "version": "1.1.0",
+ "version": "1.2.0",
"description": "Hugo Theme Dopetrope",
"main": "index.js",
"scripts": {