diff options
author | zwbetz <zwbetz@gmail.com> | 2019-04-02 21:15:26 +0300 |
---|---|---|
committer | zwbetz <zwbetz@gmail.com> | 2019-04-02 21:15:26 +0300 |
commit | 51469b0fd3ef7904dcdae0bda768ae98341d1ff4 (patch) | |
tree | a3fe06e3a7df297c5b6b5953c9d016c2bf1e0f13 | |
parent | 1b3150721691737b4ddd2aaa84571f1498eb5157 (diff) |
Don't show disqus comments if shortname has not been changed
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | layouts/partials/disqus.html | 6 | ||||
-rw-r--r-- | layouts/post/single.html | 10 |
3 files changed, 13 insertions, 5 deletions
@@ -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" }} <strong>Publish date: </strong>{{ .PublishDate.Format $dateFormat }} </div> + {{ $tags := slice }} {{ with .Params.tags }} <div> <strong>Tags: </strong> {{ range . }} {{ $href := print ("tags/" | absLangURL) (. | urlize) "/" }} - <a href="{{ $href }}">{{ . }}</a> + {{ $element := printf "<a href=\"%s\">%s</a>" $href . }} + {{ $tags = $tags | append $element }} {{ end }} + {{ delimit $tags ", " }} </div> {{ end }} {{ .Content }} - {{ $ctx := . }} - {{ with $.Site.DisqusShortname }} - {{ template "_internal/disqus.html" $ctx }} - {{ end }} + {{ partial "disqus.html" . }} {{ end }} |