From 51469b0fd3ef7904dcdae0bda768ae98341d1ff4 Mon Sep 17 00:00:00 2001 From: zwbetz Date: Tue, 2 Apr 2019 13:15:26 -0500 Subject: Don't show disqus comments if shortname has not been changed --- README.md | 2 ++ layouts/partials/disqus.html | 6 ++++++ layouts/post/single.html | 10 +++++----- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 layouts/partials/disqus.html diff --git a/README.md b/README.md index 145e6eb..8bc67f8 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,8 @@ Copy the `config.toml` or `config.yaml` from the [`exampleSite`](https://github. **TODO** explain how to change header color gradient, see http://uigradients.com +**TODO** the **extended** version of Hugo is required if you wish to make changes to the style-related params in the config file. + ## Favicons Upload your image to [RealFaviconGenerator](https://realfavicongenerator.net/) then copy-paste the generated favicon files under `static`. diff --git a/layouts/partials/disqus.html b/layouts/partials/disqus.html new file mode 100644 index 0000000..e6f4d11 --- /dev/null +++ b/layouts/partials/disqus.html @@ -0,0 +1,6 @@ +{{ $ctx := . }} +{{ with $.Site.DisqusShortname }} + {{ if ne . "yourdiscussshortname" }} + {{ template "_internal/disqus.html" $ctx }} + {{ end }} +{{ end }} diff --git a/layouts/post/single.html b/layouts/post/single.html index 4b7dc57..be81dff 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -4,18 +4,18 @@ {{ $dateFormat := $.Site.Params.dateFormat | default "Jan 2, 2006" }} Publish date: {{ .PublishDate.Format $dateFormat }} + {{ $tags := slice }} {{ with .Params.tags }}
Tags: {{ range . }} {{ $href := print ("tags/" | absLangURL) (. | urlize) "/" }} - {{ . }} + {{ $element := printf "%s" $href . }} + {{ $tags = $tags | append $element }} {{ end }} + {{ delimit $tags ", " }}
{{ end }} {{ .Content }} - {{ $ctx := . }} - {{ with $.Site.DisqusShortname }} - {{ template "_internal/disqus.html" $ctx }} - {{ end }} + {{ partial "disqus.html" . }} {{ end }} -- cgit v1.2.3