From 826fa2ee1840ffdf6f9ebd7f944dcfdf245e49e4 Mon Sep 17 00:00:00 2001
From: Maikel <maikel.bollemeijer@gmail.com>
Date: Tue, 01 May 2018 18:59:02 +0000
Subject: [PATCH] Disqus support, exampleSite preview through make commando (#16)

---
 exampleSite/config.toml    |    2 ++
 .gitignore                 |    1 +
 layouts/partials/post.html |    9 ++++++++-
 Makefile                   |   16 +++++++++++++++-
 README.md                  |   17 +++++++++++++++--
 5 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..412a09c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+**/themes/
diff --git a/Makefile b/Makefile
index 4c4b6b9..1d79012 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 CSS_DIR = ./static/css
 CSS_FILE = style.min.css
 CSS_TMP_FILE = tmp.css
-
+current_dir = $(shell pwd)
 
 .PHONY: clean build
 
@@ -12,5 +12,19 @@
 	uglifycss $(CSS_DIR)/$(CSS_TMP_FILE) > $(CSS_DIR)/$(CSS_FILE)
 	rm -f $(CSS_DIR)/$(CSS_TMP_FILE)
 
+demo: build
+	mkdir -p exampleSite/themes/coder
+	mkdir -p exampleSite/themes/coder/archetypes
+	mkdir -p exampleSite/themes/coder/images
+	mkdir -p exampleSite/themes/coder/layouts
+	mkdir -p exampleSite/themes/coder/static
+	cp -r $(current_dir)/archetypes/* exampleSite/themes/coder/archetypes/
+	cp -r $(current_dir)/images/* exampleSite/themes/coder/images
+	cp -r $(current_dir)/layouts/* exampleSite/themes/coder/layouts
+	cp -r $(current_dir)/static/* exampleSite/themes/coder/static
+	cp -r $(current_dir)/theme.toml exampleSite/themes/coder/theme.toml
+	cd examplesite && hugo serve -D
+
 clean:
 	rm -f $(CSS_DIR)/*.css
+	rm -rf exampleSite/themes/coder
diff --git a/README.md b/README.md
index cf84788..99b374e 100644
--- a/README.md
+++ b/README.md
@@ -54,6 +54,9 @@
     url = "/about/"
 ```
 
+
+
+
 You can look at full working [`config.toml`](https://github.com/luizdepra/hugo-coder/blob/master/exampleSite/config.toml) inside the [exampleSite](https://github.com/luizdepra/hugo-coder/tree/master/exampleSite) folder.
 
 ### Build & Test
@@ -69,10 +72,20 @@
 ```
 hugo server
 ```
+To preview the exampleSite, run
+```
+make demo
+```
+ The above command copies current state of the theme to exampleSite/themes and starts hugo with hugo serve -D (Go does not support Symlink directories)
+
+### Disqus
+dd the following line to your config,
+```disqusShortname = "yourdiscussshortname"``` When this is set, all posts are disqus enabled   
+You can disable comments for a post by adding the following to your page meta data.
+```disable_comments: true```
+
 
 ## To Do
-
-- Comments (probably not Disqus, sorry)
 - Tags, Categories and Series
 
 ## License
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 69bd7dd..35e3e00 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -12,6 +12,8 @@
 pygmentscodefences = true
 pygmentscodefencesguesssyntax = true
 
+disqusShortname = "yourdiscussshortname"
+
 [params]
     author = "John Doe"
     description = "John Doe's personal website"
diff --git a/layouts/partials/post.html b/layouts/partials/post.html
index b32ccd9..a48aeed 100644
--- a/layouts/partials/post.html
+++ b/layouts/partials/post.html
@@ -32,4 +32,11 @@
 
     {{ .Content }}
   </article>
-</section>
+
+  <br/>
+
+  {{ if and (not (eq .Site.DisqusShortname "" )) (eq (.Params.disable_comments | default false) false)}}
+      {{ template "_internal/disqus.html" . }}
+  {{ end }}
+  
+</section>
\ No newline at end of file

--
Gitblit v1.10.0