From 9b98c7772560f4cd98faca6ef000cb141b1cc9ee Mon Sep 17 00:00:00 2001 From: Florian Haas <610707+fghaas@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:35:20 +0100 Subject: [PATCH 1/2] Only show authors' email addresses if so configured in git-authors (#6494) Honour the git-authors plugin's setting to render the authors' names as links pointing to their email address: * If the git-authors plugin is enabled and its show_email_address option is not set, or is set to true, render the author's name as a "mailto:" link. * If the git-authors plugin is enabled and its show_email_address option is set to false, render the author's name in plain text with no link. * If the git-authors plugin is not enabled (or not installed), don't show author information. --- material/templates/partials/source-file.html | 5 +++++ src/templates/partials/source-file.html | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/material/templates/partials/source-file.html b/material/templates/partials/source-file.html index ea24d77af..b98990191 100644 --- a/material/templates/partials/source-file.html +++ b/material/templates/partials/source-file.html @@ -18,6 +18,7 @@ {% endmacro %} {% macro render_authors(authors) %} + {% set git_authors = config.plugins.get("git-authors") %} {% if authors | length == 1 %} @@ -28,9 +29,13 @@ diff --git a/src/templates/partials/source-file.html b/src/templates/partials/source-file.html index d2de99c9c..b3ecfc218 100644 --- a/src/templates/partials/source-file.html +++ b/src/templates/partials/source-file.html @@ -44,6 +44,7 @@ {% macro render_authors(authors) %} + {% set git_authors = config.plugins.get("git-authors") %} {% if authors | length == 1 %} @@ -54,9 +55,13 @@ From fc685e3a9587a48ff4a48043e470bf1d3e64c1b1 Mon Sep 17 00:00:00 2001 From: Alexander Voss Date: Thu, 14 Dec 2023 03:23:29 -0500 Subject: [PATCH 2/2] Documentation (#6506) * added code and tooltips to custom site feedback - clarifying that the feedback widget needs to be turned on - showing how to disable the form and - show the notes that are configured * undoing a minor change that we unnecessary - I changed a colon to a full stop at some point because I thought I would add another sentence, decided not to and then the unneeded change ended up in the previous commit. * turned a comment I deleted into a tooltip --- docs/setup/setting-up-site-analytics.md | 29 +++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/docs/setup/setting-up-site-analytics.md b/docs/setup/setting-up-site-analytics.md index 0f5a1da37..d1dc08656 100644 --- a/docs/setup/setting-up-site-analytics.md +++ b/docs/setup/setting-up-site-analytics.md @@ -274,18 +274,39 @@ generated by users interacting with the feedback widget with the help of some ``` js var feedback = document.forms.feedback + feedback.hidden = false // (1)! + feedback.addEventListener("submit", function(ev) { ev.preventDefault() - /* Retrieve page and feedback value */ - var page = document.location.pathname + var page = document.location.pathname // (2)! var data = ev.submitter.getAttribute("data-md-value") - /* Send feedback value */ - console.log(page, data) + console.log(page, data) // (3)! + + feedback.firstElementChild.disabled = true // (4)! + + var note = feedback.querySelector( + ".md-feedback__note [data-md-value='" + data + "']" + ) + if (note) + note.hidden = false // (5)! }) ``` + 1. The feedback widget is hidden by default so that it does not appear when + people have JavaScript turned off. So, it needs to be turned on here. + + 2. Retrieve page and feedback value. + + 3. Replace this with the code that sends the data off to your analytics + provider. + + 4. Disable the form after submission. + + 5. Show the configured notes. Which one is shown depends on the user + feedback. + === ":octicons-file-code-16: `mkdocs.yml`" ``` yaml