From 4e6faee4c28d45b752563b415cf1d99cd50ec533 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 22 May 2026 18:33:14 +0300 Subject: [PATCH 1/4] Add "Was this helpful?" feedback prompt to doc pages Posts feedback (yes/no, reason, free-text, page path) to Formspree form mjgzrgwn as JSON. Mounted in the right sidebar on pages with a TOC and inline at the bottom of MarkdownContent on TOC-less doc pages (mobile-only fallback when TOC is present). Hidden on splash pages and on landing/overview pages with a hero block in frontmatter, since those aggregate links rather than carry actionable content. --- src/components/starlight/FeedbackPrompt.astro | 397 ++++++++++++++++++ .../starlight/MarkdownContent.astro | 24 ++ src/components/starlight/PageSidebar.astro | 2 + 3 files changed, 423 insertions(+) create mode 100644 src/components/starlight/FeedbackPrompt.astro diff --git a/src/components/starlight/FeedbackPrompt.astro b/src/components/starlight/FeedbackPrompt.astro new file mode 100644 index 0000000000..39207816f2 --- /dev/null +++ b/src/components/starlight/FeedbackPrompt.astro @@ -0,0 +1,397 @@ +--- +import Icon from '~/components/starlight/Icon.astro'; + +const FORMSPREE_ENDPOINT = 'https://formspree.io/f/mjgzrgwn'; + +const questions = { + yes: [ + ['Accurate', 'accurate'], + ['Easy to understand', 'easy-to-understand'], + ['Solved my problem', 'solved-my-problem'], + ['Helped me decide to use the product', 'helped-me-decide-to-use-the-product'], + ['Other', 'other-yes'], + ], + no: [ + ['Hard to understand', 'hard-to-understand'], + ['Incorrect information', 'incorrect-information'], + ['Missing the information', 'missing-the-information'], + ['Other', 'other-no'], + ], +} as const; + +const options = ['yes', 'no'] as const; +--- + +
+ + + + + + + +
+ + + + diff --git a/src/components/starlight/MarkdownContent.astro b/src/components/starlight/MarkdownContent.astro index c9fdb47e1c..e005e884b4 100644 --- a/src/components/starlight/MarkdownContent.astro +++ b/src/components/starlight/MarkdownContent.astro @@ -6,8 +6,14 @@ import DeployGuidesNav from '../DeployGuidesNav.astro'; import MediaGuidesNav from '../MediaGuidesNav.astro'; import IntegrationsNav from '../IntegrationsNav.astro'; import MigrationGuidesNav from '../MigrationGuidesNav.astro'; +import FeedbackPrompt from './FeedbackPrompt.astro'; const { entry } = Astro.locals.starlightRoute; +const hasToc = !!Astro.locals.starlightRoute.toc; +const hasSidebar = !!Astro.locals.starlightRoute.hasSidebar; +// Landing / overview pages (those with a hero block in frontmatter) aggregate +// links to sub-pages — feedback isn't actionable there. +const showFeedback = hasSidebar && !entry.data.hero; ---
@@ -63,6 +69,14 @@ const { entry } = Astro.locals.starlightRoute; }
+{ + showFeedback && ( +
+ +
+ ) +} +