From 22aa435ab356e989e4637fa3fa8071d25ade5823 Mon Sep 17 00:00:00 2001 From: nodejh Date: Mon, 23 Oct 2017 01:52:08 +0800 Subject: [PATCH] fix bug: default show comments. And allow a post or about page to disable comments, just edit front-matter in markdown file: - disable disabledisqus: Add a line ` disabledisqus = "true" ` in front-matter For example: ``` title = "How To Vertically Middle Align Floated Elements With Flexbox" description = "How To Vertically Middle Align Floated Elements With Flexbox" date = 2017-07-28T20:53:14+08:00 tags = ["CSS"] categories = ["CSS"] draft = false disabledisqus = "true" ``` The code of this feature will update in future, because the implementation is not so good. --- layouts/_default/single.html | 4 ++-- layouts/section/about.html | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 1b15735..e6ff7f6 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -40,13 +40,13 @@ {{ end }} {{ if .Site.Params.enableDisqus }} - {{ if eq .Params.disabledisqus "true" }} + {{ if ne .Params.disabledisqus "true" }} {{ partial "disqus.html" . }} {{ end }} {{ end }} {{ if .Site.Params.enableDuoshuo }} - {{ if eq .Params.disableduoshuo "true" }} + {{ if ne .Params.disableduoshuo "true" }} {{ partial "duoshuo.html" . }} {{ end }} {{ end }} diff --git a/layouts/section/about.html b/layouts/section/about.html index 8cfc519..b601167 100644 --- a/layouts/section/about.html +++ b/layouts/section/about.html @@ -7,13 +7,13 @@ {{ .Content }} {{ if .Site.Params.enableDisqus }} - {{ if eq .Params.disabledisqus "true" }} + {{ if ne .Params.disabledisqus "true" }} {{ partial "disqus.html" . }} {{ end }} {{ end }} {{ if .Site.Params.enableDuoshuo }} - {{ if eq .Params.disableduoshuo "true" }} + {{ if ne .Params.disableduoshuo "true" }} {{ partial "duoshuo.html" . }} {{ end }} {{ end }}