Skip to content

Add dynamic Create Docs Issue link with prefilled page context#2156

Open
gmarav05 wants to merge 1 commit intomedic:mainfrom
gmarav05:add-doc-issue-link-prefill
Open

Add dynamic Create Docs Issue link with prefilled page context#2156
gmarav05 wants to merge 1 commit intomedic:mainfrom
gmarav05:add-doc-issue-link-prefill

Conversation

@gmarav05
Copy link
Copy Markdown
Contributor

@gmarav05 gmarav05 commented Mar 21, 2026

Description

This PR enhances the "Create Docs Issue" link by pre-filling the GitHub issue form with the current page context.

Fixes #2025

Changes

  1. Dynamically updates the "Create Docs Issue" link to include.
  • Page title in the issue title
  • Page URL in the issue body
  1. Implemented using JavaScript to ensure compatibility with the Hugo theme module setup.

Why

Previously, the "Create Docs Issue" link opened a blank issue form, requiring users to manually provide context.

This change improves user experience by automatically including the page name and link. It also makes it easier to report documentation issues.

Screenshots

Screen.Recording.2026-03-21.at.6.10.32.PM.mov

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@andrablaj andrablaj requested a review from 1yuv March 21, 2026 19:42
Copy link
Copy Markdown
Contributor

@mrjones-plip mrjones-plip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I see your JS based solution works well in that dynamically picks up the URL and page name and puts it into the link to create a docs issue in GitHub.

While this is a small amount of JS to run client side, ideally we could statically generate this when we generate the site and have zero client side operations. Could you see about using a static shortcode solution instead? I think maybe the examples of the existing logic to generate the $githubURL along with this template functions could unlock how to achieve this.

@gmarav05 gmarav05 force-pushed the add-doc-issue-link-prefill branch 2 times, most recently from 485dfdc to 6d854f7 Compare March 26, 2026 02:42
@gmarav05
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback! I have updated the approach to use a static Hugo template solution instead of JavaScript. Zero client-side JS for the issue link now.


Screen.Recording.2026-03-26.at.8.16.45.AM.mov

Copy link
Copy Markdown
Contributor

@mrjones-plip mrjones-plip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work!

We need to simplify the logic - this PR now has almost 200 lines of template that include a ton of logic for unrelated changes. Please see the blog post I cited already in hopes a much more simple solution of a single partial that we can include in either the hugo.toml file where we define the sidebar links or in the single.html where we define a page.

If that's not tenable, then let's revert to the prior approach of javascript as this logic, while using client side CPU, is much less invasive and easier to maintain.

thanks!

@gmarav05 gmarav05 force-pushed the add-doc-issue-link-prefill branch from 6d854f7 to 1ec72dc Compare April 1, 2026 05:55
@gmarav05
Copy link
Copy Markdown
Contributor Author

gmarav05 commented Apr 1, 2026

Thanks for the feedback, @mrjones-plip. I have simplified the code now.

Instead of overriding the entire sidebar template, I have created a small dedicated partial (layouts/partials/custom/docs-issue-link.html) that statically generates the prefilled GitHub issue URL using Hugo's .Title and .Permalink. Exactly the pattern suggested in the linked template functions reference. It's included at the bottom of layouts/docs/single.html.

Please let me know if any changes are required.

Copy link
Copy Markdown
Contributor

@mrjones-plip mrjones-plip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the follow up @gmarav05 !

While the templates are perfectly clean, there's some issues (see below). Please test your code before requesting feedback.

Issues:

  • for the template layouts/docs/single.html the link is showing below the body instead in the left hand nav (`#1) (testing on SSO page)
  • the old link is still in place (#2) (testing on SSO page)
  • the docs-issue-link.html wasn't added to the layouts/docs/list.html document so it's not showing on all pages (see sso landing and home page)
Image

@mrjones-plip
Copy link
Copy Markdown
Contributor

Also - as a follow up - if it's too complicated to use this (wonderfully simple and clean!) layouts/partials/custom/docs-issue-link.html solution above, feel free to go back to your earlier JS solution.

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.

Add Create documentation issue link on the documentation pages that passes the page name and link to page

2 participants