Use relative links where the text lands in the docs collection - #280
Open
miharp wants to merge 1 commit into
Open
Use relative links where the text lands in the docs collection#280miharp wants to merge 1 commit into
miharp wants to merge 1 commit into
Conversation
Per openvox-docs CONTRIBUTING, links within a versioned collection must be relative (page.html), not absolute. Absolute '/latest/' links silently cross version boundaries when a new major is added, and full URIs break browsing a locally served docs container offline. Two of the pup.pt replacements are rendered straight into the docs collection, so they become relative markdown links. Their siblings in these files already were: projects.md, module_structure.md, supported_plugins.md#task. The openvox-docs importer rewrites relative .md to .html on the way in, so the .md form is what belongs here. The 24 links in bolt_option_parser.rb are the awkward case: the same strings are printed by 'bolt --help', where a relative link has no base to resolve against, and are also imported as bolt_command_reference.md. Rather than break one context to satisfy the other, docs.rake now rewrites the absolute URLs to relative markdown links as it generates that page. Terminal output keeps full URIs; the published page has none. Everything else stays absolute. Guide output, error messages, and the generated Puppetfile and plan comments are printed to a terminal or written into a user's file, never rendered as part of a docs page. Anchors verified against openvox-docs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Michael Harp <mike@mikeharp.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #279. That PR merged at its first commit, so the relative-link fix discussed in this review comment never landed on
main. This is that commit, rebased.@tuxmea raised it on #279: links should be relative so a locally served docs container works offline, without internet access.
Per openvox-docs CONTRIBUTING § Linking, links within a versioned collection should be bare
page.html— not rooted/openbolt/latest/page.html, since those silently cross version boundaries when a new major collection is added.The dividing line is whether a string is ever rendered as a docs page.
Relative — rendered into the collection
lib/bolt/config/options.rbandlib/bolt/inventory/options.rb. These feed the generated reference pages and the JSON schemas, and their siblings were already relative (projects.md,module_structure.md,supported_plugins.md#task), so the absolute URLs #279 introduced were the only ones out of step.The
.mdform is deliberate: the importer atlib/puppet_references/openbolt/docs.rbrewrites relative.md→.htmlon the way in.That regex excludes anything containing
:, which is why absolute URLs passed through untouched and the problem was invisible.The dual-purpose case —
bolt_option_parser.rbThose strings are printed by
bolt --help, where a relative link has no base to resolve against, and imported asbolt_command_reference.md(it is in the importer'sGENERATED_PAGES). 16 of them land on that page.Rather than break one context for the other,
rakelib/docs.rakenow rewrites them to relative markdown links while generating that page. Terminal output keeps full URIs; the published page has none.Absolute, deliberately — unchanged
Guide output, error messages, and the comments written into generated Puppetfiles and plan templates. None is ever a docs page; a user looking at
plans.htmlin a terminal has nothing to resolve it against.Verification
rake docs:all→ zero absolute docs URLs in any generated page.bolt plan run --helpstill prints the full URI.rake schemas:allreproduces the committed schema JSON exactly.rubocopclean.AI usage disclosure
Per the Vox Pupuli and OpenVox AI Usage Policy: I used Claude Code to trace the docs import pipeline, make the change, run the verification above, and draft this description. The commit carries a
Co-Authored-Bytrailer.