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.