Skip to content

Conversation

LeahMarieBush
Copy link
Contributor

@LeahMarieBush LeahMarieBush commented Sep 24, 2025

Description

This PR updates the internal links transform so it runs for all products. This is done by setting up basePaths for each product that doesn't have them in the product config. The old mktg-content-workflow would parse the code and dynamically update these basePaths for each product but since we've changed things for UDR, it is best to manually add the basePaths here for more clarity.

This PR also includes adding a check to determine if the link being changed already has a version in it. If it does, it won't rewrite it to add the current version. This is necessary since some pages include links that authors have manually added a version to.

Testing

  1. Go to preview
  2. Verify that the links on this page include the current version in the url and go to the page for that version.
  3. Go to vault manually versioning page
  4. Verify the links on this page do not have a version more than once

Copy link

github-actions bot commented Sep 24, 2025

Vercel Previews Deployed

Name Status Preview Updated (UTC)
Dev Portal ✅ Ready (Inspect) Visit Preview Wed Oct 1 16:28:27 UTC 2025
Unified Docs API ✅ Ready (Inspect) Visit Preview Wed Oct 1 16:19:40 UTC 2025

@LeahMarieBush LeahMarieBush marked this pull request as ready for review September 24, 2025 20:13
@LeahMarieBush LeahMarieBush requested review from a team as code owners September 24, 2025 20:13
@LeahMarieBush LeahMarieBush requested review from Younique98, RubenSandwich and rmainwork and removed request for Younique98 September 24, 2025 20:13
})
// Replace the matched part of the URL with the versioned path if no version is present
if (!hasVersionInPath) {
node.url = node.url.replace(replacePattern, `/$1/${cleanVersion}$2`)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here be dragons....

We might want to be careful here with this logic as this has caused issues on dev portal URL slugs that contain versions. You can see an example of this here where the links in the dropdown get truncated to https://developer.hashicorp.com/vault/docs/v1.19.x/upgrading/upgrade-to-.

I have a dev portal PR open here. I don't know how likely we are to run into that here, but it just seemed worth mentioning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this is something I made sure to double check with the regexes I've used here. These regexes include ^ at the beginning which means that the string must start with the version. This means strings like upgrade-to-0.9.2 do not pass the regex. Here are a few example of this:
https://unified-docs-frontend-preview-i54wv6l6r-hashicorp.vercel.app/vault/docs/v1.10.x/commands - upgrade guide link at top of page
https://unified-docs-frontend-preview-i54wv6l6r-hashicorp.vercel.app/vault/docs/v1.10.x/deprecation - Filter Mount Replication Deprecation Notice link in the table
https://unified-docs-frontend-preview-i54wv6l6r-hashicorp.vercel.app/vault/docs/v1.10.x/faq/ssct - Upgrade to 1.10 link

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yeah gotcha. Somehow I didn't notice the caret at first!

Copy link
Contributor

@RubenSandwich RubenSandwich left a comment

Choose a reason for hiding this comment

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

Looks good. 👍🏻

@LeahMarieBush LeahMarieBush merged commit 92b7046 into main Oct 1, 2025
17 checks passed
@LeahMarieBush LeahMarieBush deleted the leah/fix/internal-links-transform branch October 1, 2025 19:00
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.

3 participants