Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable page feedback even without a Google analytics ID #1727

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,19 @@ For the full list of changes, see the [release][0.8.0] notes.
- SCSS: `@function prepend()` and file `assets/scss/support/_functions.scss`
have been dropped. Instead use the more general SASS/SCSS list `join()`
function ([#1385]).
- **Page feedback**, or [User feedback]: in support of projects configuring
analytics outside of Docsy, feedback functionality will be enabled regardless
of whether `site.Config.Services.GoogleAnalytics.ID` is set.
- TBC

**New**:

**Other changes**:

[#1385]: https://github.com/google/docsy/issues/1385
[0.8.0]: https://github.com/google/docsy/releases/v0.8.0/#FIXME
[User feedback]:
https://www.docsy.dev/docs/adding-content/feedback/#user-feedback

## 0.7.2

Expand Down
5 changes: 1 addition & 4 deletions layouts/_default/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ <h1>{{ .Title }}</h1>
{{ end -}}
</header>
{{ .Content }}
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) -}}
{{ partial "feedback.html" .Site.Params.ui.feedback }}
<br />
{{ end -}}
{{ partial "feedback.html" . -}}
{{ if (.Site.Params.DisqusShortname) -}}
<br />
{{- partial "disqus-comment.html" . -}}
Expand Down
5 changes: 1 addition & 4 deletions layouts/docs/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ <h1>{{ .Title }}</h1>
</header>
{{ .Content }}
{{ partial "section-index.html" . -}}
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) -}}
{{ partial "feedback.html" .Site.Params.ui.feedback -}}
<br />
{{ end -}}
{{ partial "feedback.html" . -}}
{{ if (.Site.DisqusShortname) -}}
<br />
{{- partial "disqus-comment.html" . -}}
Expand Down
5 changes: 5 additions & 0 deletions layouts/partials/feedback.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable)) -}}
{{ with .Site.Params.ui.feedback -}}
<style>
.feedback--answer {
display: inline-block;
Expand Down Expand Up @@ -57,3 +59,6 @@ <h2 class="feedback--title">{{- i18n "feedback_title" -}}</h2>
sendFeedback(0);
});
</script>
{{ end -}}
<br />
{{ end -}}
5 changes: 1 addition & 4 deletions layouts/swagger/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ <h1>{{ .Title }}</h1>
</header>
{{ .Content }}
{{ partial "section-index.html" . -}}
{{ if (and (not .Params.hide_feedback) (.Site.Params.ui.feedback.enable) (.Site.GoogleAnalytics)) -}}
{{ partial "feedback.html" .Site.Params.ui.feedback -}}
<br />
{{ end -}}
{{ partial "feedback.html" . -}}
{{ if (.Site.DisqusShortname) -}}
<br />
{{ partial "disqus-comment.html" . -}}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}",
"postinstall": "npm run _mkdir:hugo-mod && npm run _cp:bs-rfs",
"serve": "npm run cd:docs serve",
"test": "npm run cd:docs test",
"test": "npm run cd:docs test && npm run check:links--md",
"update:pkg:hugo": "npm install --save-exact -D hugo-extended@latest",
"update:pkg:dep": "npm install --save-exact @fortawesome/fontawesome-free@latest bootstrap@latest"
},
Expand Down
17 changes: 13 additions & 4 deletions userguide/content/en/docs/adding-content/feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,18 @@ other words!

### Setup

1. Open `hugo.toml`/`hugo.yaml`/`hugo.json`.
2. Ensure that Google Analytics is enabled, as described [above](#setup).
3. Set the response text that users see after clicking **Yes** or **No**.
{{% alert title="Version note" color=warning %}}

As of Docsy version [0.8.0], feedback will be enabled whether
`site.Config.Services.GoogleAnalytics.ID` is set or not. This supports the use
case where analytics is configured outside of Docsy.

[0.8.0]: https://github.com/google/docsy/blob/main/CHANGELOG.md/#080

{{% /alert %}}

1. Open your project's Hugo configuration file.
2. Set the response text that users see after clicking **Yes** or **No**.

{{< tabpane >}}
{{< tab header="Configuration file:" disabled=true />}}
Expand Down Expand Up @@ -174,7 +183,7 @@ params:
{{< /tab >}}
{{< /tabpane >}}

4. Save and close `hugo.toml`/`hugo.yaml`/`hugo.json`.
3. Save the edits to your configuration file.

### Access the feedback data

Expand Down
2 changes: 1 addition & 1 deletion userguide/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ menu:

services:
googleAnalytics:
id: UA-00000000-0
# id: G-XXXXXXXXX # Waiting on https://github.com/google/docsy/issues/1097

languages:
en:
Expand Down