From 4db01b15ec4a07c8e6571f8b3862661c4b610707 Mon Sep 17 00:00:00 2001 From: James Ray Date: Mon, 28 Feb 2022 13:03:48 -0500 Subject: [PATCH] Create comments and analytics posts relates to hugo-toha/toha#543 --- .../posts/analytics/{index.md => _index.md} | 4 +- content/posts/analytics/comments/index.md | 84 +++++++++++++++++++ .../analytics/{ => google_analytics}/hero.svg | 0 .../posts/analytics/google_analytics/index.md | 30 +++++++ 4 files changed, 115 insertions(+), 3 deletions(-) rename content/posts/analytics/{index.md => _index.md} (62%) create mode 100644 content/posts/analytics/comments/index.md rename content/posts/analytics/{ => google_analytics}/hero.svg (100%) create mode 100644 content/posts/analytics/google_analytics/index.md diff --git a/content/posts/analytics/index.md b/content/posts/analytics/_index.md similarity index 62% rename from content/posts/analytics/index.md rename to content/posts/analytics/_index.md index 0f3a55a8..9a3714e7 100644 --- a/content/posts/analytics/index.md +++ b/content/posts/analytics/_index.md @@ -1,12 +1,10 @@ --- title: "Analytics and Comments" date: 2020-06-08T06:00:23+06:00 -description: Adding analytics and disquss comment in hugo theme Toha +description: Adding analytics and comments in hugo theme Toha menu: sidebar: name: Analytics & Comments identifier: analytics-and-comments weight: 600 --- - -### Complete Post Coming Soon... diff --git a/content/posts/analytics/comments/index.md b/content/posts/analytics/comments/index.md new file mode 100644 index 00000000..30c5d1a9 --- /dev/null +++ b/content/posts/analytics/comments/index.md @@ -0,0 +1,84 @@ +--- +title: "Comments" +date: 2020-06-08T06:00:23+06:00 +description: Adding comments in hugo theme Toha +author: + name: James Ray + image: images/author/james.jpg +menu: + sidebar: + name: Comments + identifier: comments + parent: analytics-and-comments + weight: 200 +--- + +## Comments + +Comments can be provided by a few different plugins. Your options are [Disqus](https://disqus.com/), [Valine](https://valine.js.org/), [Utterances](https://utteranc.es/), or [Giscus](https://giscus.app/). + +### Disqus +Disqus is a popular comment plug-in. After signing up to [Disqus](https://disqus.com/) you will need to provide your shortname in your config file, and you will be good to go. You can provide it in two locations. The first is in the root of your site configuration as `DisqusShortname`. Or as a param feature as shown here: + +```yaml +params: + features: + comment: + enabled: true + disqus: + shortName: your-disqus-shortname +``` + +### Valine +[Valine](https://valine.js.org/) appears to be a Chinese comments comments plugin. Therefore my information on this will be limited to the configuration. + +```yaml +valine: + appId: app-id + appKey: app-key + avatar: avatar + placeholder: placeholder + lang: lang + recordIP: recordIP + enableQQ: enableQQ +``` + +### Utterances +Utterances uses [GitHub Issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/about-issues) to store the comments for your posts. This requires you to allow have a public repository, and the Utterances app to use your repository. Setup instructions can be found at the [Utterances home page](https://utteranc.es/). + +```yaml +params: + features: + comment: + enabled: true + utteranc: + repo: your-repo/name + issueTerm: url + theme: light +``` + +### Giscus +Giscus is based off Utterances, but uses [GitHub Discussions](https://docs.github.com/en/discussions) as the backend. This requires you to allow have a public repository, and the Giscus app to use your repository. Setup instructions can be found at the [Giscus home page](https://giscus.app/). This will also allow you to look at some of the configuration options. + +To enable Giscus you will need to set the following items in your configuration file + +```yaml +params: + features: + comment: + enabled: true + giscus: + repo: your-repo/name +``` + +Optional Parameters and defaults are as follows: + +```yaml +category: General +theme: light +map: url +reaction: 1 +metadata: 0 +inputPosition: bottom +crossOrigin: anonymous +``` diff --git a/content/posts/analytics/hero.svg b/content/posts/analytics/google_analytics/hero.svg similarity index 100% rename from content/posts/analytics/hero.svg rename to content/posts/analytics/google_analytics/hero.svg diff --git a/content/posts/analytics/google_analytics/index.md b/content/posts/analytics/google_analytics/index.md new file mode 100644 index 00000000..9cbbe177 --- /dev/null +++ b/content/posts/analytics/google_analytics/index.md @@ -0,0 +1,30 @@ +--- +title: "Google Analytics" +date: 2020-06-08T06:00:23+06:00 +description: Adding analytics in hugo theme Toha +hero: hero.svg +author: + name: James Ray + image: images/author/james.jpg +menu: + sidebar: + name: Google Analytics + identifier: google-analytics + parent: analytics-and-comments + weight: 100 +--- + +## Analytics + +Currently the Toha theme only supports Google Analytics. This can be accomplished by providing a [Tracking ID (property number) or Measurement ID](https://support.google.com/analytics/answer/7372977?hl=en). Toha is will detect which version you are using and either provide the v3 or v4 google analytics. You can define the `googleAnalytics` variable in the root configuration level and Toha takes care of the rest. + +For more information about Google Analytics please see [Google's About Page](https://marketingplatform.google.com/about/analytics/) + + +```yaml +googleAnalytics: G-1234x345 +``` + +```yaml +googleAnalytics: UA-1234891234 +```