From 406233f05204966f6799a42e39b0e6cdf4e0da0c Mon Sep 17 00:00:00 2001 From: Michael Whatcott Date: Thu, 5 Jun 2014 23:32:06 -0600 Subject: [PATCH] Included instructions for omitting disqus comments on localhost. --- docs/content/extras/comments.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/docs/content/extras/comments.md b/docs/content/extras/comments.md index a0f881c51..2b8cce7c4 100644 --- a/docs/content/extras/comments.md +++ b/docs/content/extras/comments.md @@ -44,6 +44,38 @@ for a given piece of content * **disqus_title** * **disqus_url** + +## Conditional Loading of Disqus Comments + +Users have noticed that enabling disqus comments when running the hugo web server on localhost causes the creation of unwanted discussions on the associated disqus account. In order to prevent this, a slightly tweaked partial template is required. So, rather than using the built-in `"_internal/disqus.html"` template referenced above, create a template in your `partials` folder that looks like this: + +```javascript +
+ + +comments powered by Disqus +``` + +Notice that there is a simple if statement that detects when you are running on localhost and skips the initialization of the disqus comment injection. + +Now reference the partial template from your page template: + + {{ template "partials/disqus.html" . }} + + # Alternatives A few alternatives exist to Disqus.