From 875a3e5fa6a7ecddf544daa123f1971bc8110db9 Mon Sep 17 00:00:00 2001 From: George Cushen Date: Sun, 28 Aug 2022 00:55:16 +0100 Subject: [PATCH] feat: add page feedback widget Requires Google Analytics and production env. New front-matter param for Book layout: feedback: true --- modules/wowchemy/config.yaml | 4 + modules/wowchemy/i18n/en.yaml | 14 +++ modules/wowchemy/layouts/_default/baseof.html | 2 + .../layouts/partials/book_layout.html | 2 + .../layouts/partials/components/feedback.html | 70 +++++++++++++++ starters/academic/config/_default/config.yaml | 3 + starters/academic/config/_default/params.yaml | 8 +- starters/blog/config/_default/config.yaml | 2 + starters/blog/config/_default/params.yaml | 6 +- .../post/writing-technical-content/index.md | 85 ++++++++++++++++++- starters/course/config/_default/config.yaml | 2 + starters/course/config/_default/params.yaml | 6 +- .../documentation/config/_default/config.yaml | 2 + .../documentation/config/_default/params.yaml | 10 ++- .../config/_default/config.yaml | 3 + starters/minimal/config/_default/config.yaml | 2 + starters/notes/config/_default/config.yaml | 2 + .../portfolio/config/_default/config.yaml | 2 + 18 files changed, 206 insertions(+), 19 deletions(-) create mode 100644 modules/wowchemy/layouts/partials/components/feedback.html diff --git a/modules/wowchemy/config.yaml b/modules/wowchemy/config.yaml index 49eeefc2..52dce712 100644 --- a/modules/wowchemy/config.yaml +++ b/modules/wowchemy/config.yaml @@ -16,6 +16,10 @@ markup: tableOfContents: startLevel: 2 endLevel: 3 +minify: + tdewolff: + html: + keepComments: true sitemap: changefreq: weekly module: diff --git a/modules/wowchemy/i18n/en.yaml b/modules/wowchemy/i18n/en.yaml index d2d36cc8..d4d468ff 100644 --- a/modules/wowchemy/i18n/en.yaml +++ b/modules/wowchemy/i18n/en.yaml @@ -266,3 +266,17 @@ - id: published_with translation: Published with {wowchemy} — the free, {repo_link}open source{/repo_link} website builder that empowers creators. + +# Feedback widget + +- id: feedback_widget_title + translation: Feedback + +- id: feedback_widget_question + translation: Was this page helpful? + +- id: feedback_widget_answer_positive + translation: 😍 Yes + +- id: feedback_widget_answer_negative + translation: 😡 No diff --git a/modules/wowchemy/layouts/_default/baseof.html b/modules/wowchemy/layouts/_default/baseof.html index 50e92494..873ce308 100644 --- a/modules/wowchemy/layouts/_default/baseof.html +++ b/modules/wowchemy/layouts/_default/baseof.html @@ -1,4 +1,6 @@ +{{ "" | safeHTML }} +{{ printf "" (now | time.Format ":date_long") | safeHTML }} {{- $language_code := site.LanguageCode | default "en-us" -}} diff --git a/modules/wowchemy/layouts/partials/book_layout.html b/modules/wowchemy/layouts/partials/book_layout.html index d73c1e8e..ec1c99c5 100644 --- a/modules/wowchemy/layouts/partials/book_layout.html +++ b/modules/wowchemy/layouts/partials/book_layout.html @@ -80,6 +80,8 @@ + {{ partial "components/feedback" . }} + {{ partial "tags.html" . }} {{/* Show next/previous pages by default. */}} diff --git a/modules/wowchemy/layouts/partials/components/feedback.html b/modules/wowchemy/layouts/partials/components/feedback.html new file mode 100644 index 00000000..411219ad --- /dev/null +++ b/modules/wowchemy/layouts/partials/components/feedback.html @@ -0,0 +1,70 @@ +{{ $ga := site.Params.marketing.analytics.google_analytics | default site.GoogleAnalytics | default "" }} +{{ $show_feedback := .Params.feedback | default true }} + +{{ if hugo.IsProduction | and $ga | and $show_feedback }} + +
+ + + + + + +
+ +{{ end }} diff --git a/starters/academic/config/_default/config.yaml b/starters/academic/config/_default/config.yaml index 0fbdcbc2..58bfbdc8 100644 --- a/starters/academic/config/_default/config.yaml +++ b/starters/academic/config/_default/config.yaml @@ -23,6 +23,7 @@ module: imports: - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify-cms - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify + - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-reveal - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5 ############################ @@ -70,3 +71,5 @@ security: _merge: deep sitemap: _merge: deep +minify: + _merge: deep diff --git a/starters/academic/config/_default/params.yaml b/starters/academic/config/_default/params.yaml index 94488c32..73fe7d9f 100644 --- a/starters/academic/config/_default/params.yaml +++ b/starters/academic/config/_default/params.yaml @@ -61,10 +61,8 @@ locale: features: syntax_highlighter: - enable: true - extra_languages: - - r - - latex + theme_light: github-light + theme_dark: dracula math: enable: false privacy_pack: @@ -72,7 +70,7 @@ features: repository: url: 'https://github.com//' content_dir: content - branch: master + branch: main avatar: gravatar: false shape: circle diff --git a/starters/blog/config/_default/config.yaml b/starters/blog/config/_default/config.yaml index d697aa7a..8c6a2a00 100644 --- a/starters/blog/config/_default/config.yaml +++ b/starters/blog/config/_default/config.yaml @@ -89,3 +89,5 @@ security: _merge: deep sitemap: _merge: deep +minify: + _merge: deep diff --git a/starters/blog/config/_default/params.yaml b/starters/blog/config/_default/params.yaml index 93bba069..a6db38e2 100644 --- a/starters/blog/config/_default/params.yaml +++ b/starters/blog/config/_default/params.yaml @@ -58,10 +58,8 @@ locale: features: syntax_highlighter: - enable: true - extra_languages: - - r - - latex + theme_light: github-light + theme_dark: dracula math: enable: false privacy_pack: diff --git a/starters/blog/content/post/writing-technical-content/index.md b/starters/blog/content/post/writing-technical-content/index.md index ca094d05..a2baaf41 100644 --- a/starters/blog/content/post/writing-technical-content/index.md +++ b/starters/blog/content/post/writing-technical-content/index.md @@ -2,7 +2,6 @@ title: Writing technical content in Markdown date: 2019-07-12 math: true -highlight: true image: placement: 2 caption: 'Image credit: [**John Moeses Bauan**](https://unsplash.com/photos/OGZtQF8iC0g)' @@ -18,7 +17,7 @@ On this page, you'll find some examples of the types of technical content that c ### Code -Wowchemy supports a Markdown extension for highlighting code syntax. You can enable this feature by toggling the `syntax_highlighter` option in your `config/_default/params.toml` file. +Wowchemy supports a Markdown extension for highlighting code syntax. You can customize the styles under the `syntax_highlighter` option in your `config/_default/params.yaml` file. ```python import pandas as pd @@ -34,6 +33,88 @@ data = pd.read_csv("data.csv") data.head() ``` +### Mindmaps + +Wowchemy supports a Markdown extension for mindmaps. + +Simply insert a Markdown `markmap` code block and optionally set the height of the mindmap as shown in the example below. + +A simple mindmap defined as a Markdown list: + +
+
+
+```markmap {height="200px"}
+- Hugo Modules
+  - wowchemy
+  - wowchemy-plugins-netlify
+  - wowchemy-plugins-netlify-cms
+  - wowchemy-plugins-reveal
+```
+
+
+
+ +renders as + +```markmap {height="200px"} +- Hugo Modules + - wowchemy + - wowchemy-plugins-netlify + - wowchemy-plugins-netlify-cms + - wowchemy-plugins-reveal +``` + +A more advanced mindmap with formatting, code blocks, and math: + +
+
+
+```markmap
+- Mindmaps
+  - Links
+    - [Wowchemy Docs](https://wowchemy.com/docs/)
+    - [Discord Community](https://discord.gg/z8wNYzb)
+    - [GitHub](https://github.com/wowchemy/wowchemy-hugo-themes)
+  - Features
+    - Markdown formatting
+    - **inline** ~~text~~ *styles*
+    - multiline
+      text
+    - `inline code`
+    -
+      ```js
+      console.log('hello');
+      console.log('code block');
+      ```
+    - Math: $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$
+```
+
+
+
+ +renders as + +```markmap +- Mindmaps + - Links + - [Wowchemy Docs](https://wowchemy.com/docs/) + - [Discord Community](https://discord.gg/z8wNYzb) + - [GitHub](https://github.com/wowchemy/wowchemy-hugo-themes) + - Features + - Markdown formatting + - **inline** ~~text~~ *styles* + - multiline + text + - `inline code` + - + ```js + console.log('hello'); + console.log('code block'); + ``` + - Math: $x = {-b \pm \sqrt{b^2-4ac} \over 2a}$ +``` + ### Charts Wowchemy supports the popular [Plotly](https://plot.ly/) format for interactive charts. diff --git a/starters/course/config/_default/config.yaml b/starters/course/config/_default/config.yaml index 6de1b7c8..e5a12250 100644 --- a/starters/course/config/_default/config.yaml +++ b/starters/course/config/_default/config.yaml @@ -83,3 +83,5 @@ security: _merge: deep sitemap: _merge: deep +minify: + _merge: deep diff --git a/starters/course/config/_default/params.yaml b/starters/course/config/_default/params.yaml index 9e63c001..9d961991 100644 --- a/starters/course/config/_default/params.yaml +++ b/starters/course/config/_default/params.yaml @@ -60,10 +60,8 @@ locale: features: syntax_highlighter: - enable: true - extra_languages: - - r - - latex + theme_light: github-light + theme_dark: dracula math: enable: false privacy_pack: diff --git a/starters/documentation/config/_default/config.yaml b/starters/documentation/config/_default/config.yaml index 2740bbb7..68f3e6e9 100644 --- a/starters/documentation/config/_default/config.yaml +++ b/starters/documentation/config/_default/config.yaml @@ -79,3 +79,5 @@ security: _merge: deep sitemap: _merge: deep +minify: + _merge: deep diff --git a/starters/documentation/config/_default/params.yaml b/starters/documentation/config/_default/params.yaml index e09259ff..e23bfac2 100644 --- a/starters/documentation/config/_default/params.yaml +++ b/starters/documentation/config/_default/params.yaml @@ -58,10 +58,8 @@ locale: features: syntax_highlighter: - enable: false - extra_languages: - - r - - latex + theme_light: github-light + theme_dark: dracula math: enable: false privacy_pack: @@ -70,6 +68,10 @@ features: url: 'https://github.com/wowchemy/hugo-documentation-theme' content_dir: content branch: main + feedback: + responses: + positive: 'Glad to hear it! [Any ideas for improvements?](https://github.com///issues/new).' + negative: 'Sorry to hear that. [Please tell us how we can improve](https://github.com///issues/new).' comment: provider: '' disqus: diff --git a/starters/markdown-slides/config/_default/config.yaml b/starters/markdown-slides/config/_default/config.yaml index 51283de1..d519d6d2 100644 --- a/starters/markdown-slides/config/_default/config.yaml +++ b/starters/markdown-slides/config/_default/config.yaml @@ -23,6 +23,7 @@ module: imports: - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify-cms - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-netlify + - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-plugin-reveal - path: github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy/v5 ############################ @@ -64,3 +65,5 @@ related: weight: 70 security: _merge: deep +minify: + _merge: deep diff --git a/starters/minimal/config/_default/config.yaml b/starters/minimal/config/_default/config.yaml index 66f86155..0a3e20e8 100644 --- a/starters/minimal/config/_default/config.yaml +++ b/starters/minimal/config/_default/config.yaml @@ -69,3 +69,5 @@ security: _merge: deep sitemap: _merge: deep +minify: + _merge: deep diff --git a/starters/notes/config/_default/config.yaml b/starters/notes/config/_default/config.yaml index d3a895ab..d914c30c 100644 --- a/starters/notes/config/_default/config.yaml +++ b/starters/notes/config/_default/config.yaml @@ -80,3 +80,5 @@ security: _merge: deep sitemap: _merge: deep +minify: + _merge: deep diff --git a/starters/portfolio/config/_default/config.yaml b/starters/portfolio/config/_default/config.yaml index a21a6642..b5f0f770 100644 --- a/starters/portfolio/config/_default/config.yaml +++ b/starters/portfolio/config/_default/config.yaml @@ -82,3 +82,5 @@ security: _merge: deep sitemap: _merge: deep +minify: + _merge: deep