Skip to content

fix(docs): only show feedback button on prose - #82

Merged
vito merged 1 commit into
mainfrom
docs-feedback-prose-filter
Jun 4, 2026
Merged

vito merged 1 commit into
mainfrom
docs-feedback-prose-filter

Conversation

@vito

@vito vito commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Feedback

These "GitHub", "pkg.go.dev", and all the list items / links in the table of contents below shouldn't have a "feedback" button — way too noisy. We only want a 'feedback' button for list items that contain prose. Can you find a good filter for detecting that?

(page: /)

Change

The widget attached a feedback button to every main li/main p, so the GitHub / pkg.go.dev header links (rendered as <p><a>…</a></p>) and every table-of-contents entry got a button with nothing to comment on.

Added an isProse() filter applied before attaching. An element is skipped when:

  • it lives inside a <nav> — that's the table of contents, so all TOC entries are covered at once; or
  • its entire text is a single link (the GitHub / pkg.go.dev links, or a bare cross-ref).

A genuine prose item that contains a link is kept, since its text is more than the link's — e.g. see <a>Functions</a> for the full set. Verified against the built HTML: the only site-wide single-link items outside <nav> are exactly GitHub and pkg.go.dev.

The feedback widget attached a button to every list item and link-only
paragraph, so the GitHub/pkg.go.dev header links and every table-of-
contents entry sprouted noisy feedback buttons with nothing to comment
on.

Filter the candidates to prose: skip anything inside a <nav> (the table
of contents) and any element whose entire text is a single link. A list
item with prose around a link keeps its button.

Signed-off-by: Alex Suraci <[email protected]>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

@vito
vito merged commit 2ae5d93 into main Jun 4, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant