diff options
author | parsiya@gmail.com <parsiya@gmail.com> | 2016-04-03 20:51:25 +0300 |
---|---|---|
committer | parsiya@gmail.com <parsiya@gmail.com> | 2016-04-03 20:51:25 +0300 |
commit | 0b68aa05b5fc847ccc0474be05e338ab1577d413 (patch) | |
tree | 00ca7629d752b5fe4a00e7892ec4dca3ed06b69c | |
parent | 9a026aef25aa0db66ffe6921a4481d3c1227ef93 (diff) |
Add disqus into template only when it is set in config and support disabling comments in frontmatter. Fixes #11
-rw-r--r-- | layouts/partials/post_footer.html | 15 | ||||
-rw-r--r-- | sample-config.toml | 3 |
2 files changed, 10 insertions, 8 deletions
diff --git a/layouts/partials/post_footer.html b/layouts/partials/post_footer.html index 5ee00ab..261ed5f 100644 --- a/layouts/partials/post_footer.html +++ b/layouts/partials/post_footer.html @@ -6,14 +6,14 @@ <!-- can't put the .Date.Format inside the datetime attribute because of double quotes, so it's outside --> <time>{{ .Date.Format "Jan 2, 2006" }}</time> <span class="categories"> - Tags: + Tags: {{ if isset .Params "tags" }} <!-- need to convert the tags to lower for the URLs to work --> {{ range .Params.tags }}<a class="category" href="{{ "/tags/" | absURL }}{{ . | urlize | lower }}">{{ . }}</a> {{ end }} {{ end }} </span> </p> - + <!-- For sharing stuff --> <!-- <div class="sharing"> </div> --> @@ -29,12 +29,13 @@ <a class="basic-alignment left" href="{{ .Permalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a> {{ end }} - {{ with .NextInSection }} + {{ with .NextInSection }} <a class="basic-alignment right" href="{{ .Permalink }}" title="{{ .LinkTitle }}">{{ .LinkTitle }}</a> {{ end }} </p> - - {{ partial "disqus.html" . }} + {{ if isset .Site.Params "disqusShortname" }} + {{ if not (eq .Params.comments false) }} + {{ partial "disqus.html" . }} + {{ end }} + {{ end }} </footer> - -
\ No newline at end of file diff --git a/sample-config.toml b/sample-config.toml index 4448fbd..ba66db2 100644 --- a/sample-config.toml +++ b/sample-config.toml @@ -81,6 +81,7 @@ post = "/blog/:year-:month-:day-:title/" # change the post URL to look like the googleAnalytics = "google analytics" # disqus shortcode + # disable comments for a specific post by adding "comments: false" in its frontmatter disqusShortname = "Your Google Analytics tracking code" # sidebar links @@ -110,7 +111,7 @@ post = "/blog/:year-:month-:day-:title/" # change the post URL to look like the notfound_text = """Please either go back or use the navigation/sidebar menus. """ - + # blackfriday is Hugo's markdown engine. Options are at: https://gohugo.io/overview/configuration/ (scroll down to "Configure Blackfriday rendering") [blackfriday] hrefTargetBlank = true # open the external links in a new window |