Add dynamic Create Docs Issue link with prefilled page context#2156
Add dynamic Create Docs Issue link with prefilled page context#2156gmarav05 wants to merge 1 commit intomedic:mainfrom
Conversation
mrjones-plip
left a comment
There was a problem hiding this comment.
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.
485dfdc to
6d854f7
Compare
|
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 |
mrjones-plip
left a comment
There was a problem hiding this comment.
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!
6d854f7 to
1ec72dc
Compare
|
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. |
mrjones-plip
left a comment
There was a problem hiding this comment.
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.htmlthe 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.htmlwasn't added to thelayouts/docs/list.htmldocument so it's not showing on all pages (see sso landing and home page)
|
Also - as a follow up - if it's too complicated to use this (wonderfully simple and clean!) |
Description
This PR enhances the "Create Docs Issue" link by pre-filling the GitHub issue form with the current page context.
Fixes #2025
Changes
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.