From 93e08e1956b5293b3005bbfe04ed2b304529a222 Mon Sep 17 00:00:00 2001 From: Tom Bennet Date: Tue, 18 Jul 2017 20:13:40 +0100 Subject: [PATCH] Fix links to Disqus template documentation Links were pointing at the Partials page - more useful to link directly to the Disqus section of Internal Templates page --- content/content-management/comments.md | 9 ++-- content/templates/internal.md | 66 ++++---------------------- 2 files changed, 13 insertions(+), 62 deletions(-) diff --git a/content/content-management/comments.md b/content/content-management/comments.md index 2db449738..075808772 100644 --- a/content/content-management/comments.md +++ b/content/content-management/comments.md @@ -19,7 +19,7 @@ toc: true Hugo ships with support for [Disqus](https://disqus.com/), a third-party service that provides comment and community capabilities to websites via JavaScript. -Your theme may already support Disqus, but if not, it is easy to add to your templates via [Hugo's built-in Disqus partial][disquspartial]. +Your theme may already support Disqus, but if not, it is easy to add to your templates via [Hugo's built-in Disqus template][disqustemplate]. ## Add Disqus @@ -43,9 +43,9 @@ For many websites, this is enough configuration. However, you also have the opti * `disqus_title` * `disqus_url` -### Render Hugo's Built-in Disqus Partial Template +### Render Hugo's Built-in Disqus Template -See [Partial Templates][partials] to learn how to add the Disqus partial to your Hugo website's templates. +See [Internal Templates][disqustemplate] to learn how to add Disqus to your Hugo website. ## Comments Alternatives @@ -72,13 +72,12 @@ Written using Go, Socket.io, and [MongoDB][], Kaiju is very fast and easy to dep It is in early development but shows promise. If you have interest, please help by contributing via pull request, [opening an issue in the Kaiju GitHub repository][kaijuissue], or [Tweeting about it][tweet]. Every bit helps. --> [configuration]: /getting-started/configuration/ -[disquspartial]: /templates/partials/#disqus +[disqustemplate]: /templates/internal/#disqus [disqussetup]: https://disqus.com/profile/signup/ [forum]: https://discourse.gohugo.io [front matter]: /content-management/front-matter/ [Graph Comment]: https://graphcomment.com/ [kaijuissue]: https://github.com/spf13/kaiju/issues/new [issotutorial]: https://stiobhart.net/2017-02-24-isso-comments/ -[partials]: /templates/partials/ [MongoDB]: https://www.mongodb.com/ [tweet]: https://twitter.com/spf13 diff --git a/content/templates/internal.md b/content/templates/internal.md index 022e95c3c..19ba0c3d2 100644 --- a/content/templates/internal.md +++ b/content/templates/internal.md @@ -33,11 +33,11 @@ Hugo ships with internal templates for Google Analytics tracking, including both Provide your tracking id in your configuration file: -``` +```toml googleAnalytics = "UA-123-45" ``` -``` +```yml googleAnalytics: "UA-123-45" ``` @@ -45,28 +45,28 @@ googleAnalytics: "UA-123-45" You can then include the Google Analytics internal template: -``` +```golang {{ template "_internal/google_analytics.html" . }} ``` -``` +```golang {{ template "_internal/google_analytics_async.html" . }} ``` ## Disqus -Hugo also ships with an internal template for [Disqus comments][disqus], a popular commenting system for both static and dynamic websites. In order to effectively use Disqus, you will need to secure a Disqus "shortname" by [signing up for the free service][disqussignup]. +Hugo also ships with an internal template for Disqus, a popular commenting system for both static and dynamic websites. In order to use Disqus, you will need to secure a Disqus "shortname" by [signing up for the free service](https://disqus.com/profile/signup/). ### Configure Disqus To use Hugo's Disqus template, you first need to set a single value in your site's `config.toml` or `config.yml`: -``` +```toml disqusShortname = "yourdiscussshortname" ``` -``` +```yaml disqusShortname: "yourdiscussshortname" ``` @@ -80,56 +80,8 @@ You also have the option to set the following in the front matter for a given pi To add Disqus, include the following line in templates where you want your comments to appear: -``` +```golang {{ template "_internal/disqus.html" . }} ``` -### Conditional Loading of Disqus Comments - -Users have noticed that enabling Disqus comments when running the Hugo web server on `localhost` (i.e. via `hugo server`) causes the creation of unwanted discussions on the associated Disqus account. - -You can create the following `layouts/partials/disqus.html`: - -{{< code file="layouts/partials/disqus.html" download="disqus.html" >}} -
- - -comments powered by Disqus -{{< /code >}} - -The `if` statement skips the initialization of the Disqus comment injection when you are running on `localhost`. - -You can then render your custom Disqus partial template as follows: - -``` -{{ partial "disqus.html" . }} -``` - -``` -_internal/_default/robots.txt -_internal/_default/rss.xml -_internal/_default/sitemap.xml -_internal/_default/sitemapindex.xml - -_internal/disqus.html -_internal/google_news.html -_internal/google_analytics.html -_internal/google_analytics_async.html -_internal/opengraph.html -_internal/pagination.html -_internal/schema.html -_internal/twitter_cards.html -``` +Be aware that this template will not load Disqus when you are previewing your website locally. When running on `localhost` (i.e. via `hugo server`), initialization of Disqus is skipped to avoid creating unwanted discussions on your Disqus account.