From 312046ca1ed19a802f11bc0098f0a043153a3de0 Mon Sep 17 00:00:00 2001 From: William Dalessandro Date: Tue, 14 Oct 2025 17:14:09 -0400 Subject: [PATCH 1/5] adding in prod support for hcp-docs --- config/production.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/production.json b/config/production.json index 6ef5cc7b15..2e798b12ee 100644 --- a/config/production.json +++ b/config/production.json @@ -32,7 +32,8 @@ "ptfe-releases", "well-architected-framework", "terraform-enterprise", - "sentinel" + "sentinel", + "hcp-docs" ] } } From b838a80d381e9873add58231da67cc05cdcc224a Mon Sep 17 00:00:00 2001 From: William Dalessandro Date: Tue, 14 Oct 2025 17:23:19 -0400 Subject: [PATCH 2/5] updating test to not fail build steps --- config/__tests__/index.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/config/__tests__/index.test.js b/config/__tests__/index.test.js index 85a49fe466..ba6121fd99 100644 --- a/config/__tests__/index.test.js +++ b/config/__tests__/index.test.js @@ -42,6 +42,7 @@ describe('loadHashiConfigByEnvironment', () => { "well-architected-framework", "terraform-enterprise", "sentinel", + "hcp-docs" ], "foo": "bar", } From 4db7e62b7d173d62e200e73ab8a0c3875cc37b7e Mon Sep 17 00:00:00 2001 From: William Dalessandro Date: Tue, 14 Oct 2025 17:55:49 -0400 Subject: [PATCH 3/5] missing comma --- config/__tests__/index.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/__tests__/index.test.js b/config/__tests__/index.test.js index ba6121fd99..7f01b33064 100644 --- a/config/__tests__/index.test.js +++ b/config/__tests__/index.test.js @@ -42,7 +42,7 @@ describe('loadHashiConfigByEnvironment', () => { "well-architected-framework", "terraform-enterprise", "sentinel", - "hcp-docs" + "hcp-docs", ], "foo": "bar", } From fb738e2cfc9c116f6bf93afe4c30a86aab3316e1 Mon Sep 17 00:00:00 2001 From: Leah Bush <157434496+LeahMarieBush@users.noreply.github.com> Date: Mon, 13 Oct 2025 15:43:01 -0500 Subject: [PATCH 4/5] fix: allow definitions as a type in remarkRewriteAssets (#2862) --- .../remark-plugins/remark-rewrite-assets.ts | 84 ++++++++++++------- 1 file changed, 54 insertions(+), 30 deletions(-) diff --git a/src/lib/remark-plugins/remark-rewrite-assets.ts b/src/lib/remark-plugins/remark-rewrite-assets.ts index f3f1f21047..7c9bc4c0cb 100644 --- a/src/lib/remark-plugins/remark-rewrite-assets.ts +++ b/src/lib/remark-plugins/remark-rewrite-assets.ts @@ -28,48 +28,72 @@ export function remarkRewriteAssets(args: { return function plugin() { return function transform(tree) { - // @ts-expect-error Types Should be correct here - visitParents(tree, 'image', (node, ancestors: Array) => { - let url - const originalUrl = node.url + visitParents( + // @ts-expect-error Types Should be correct here + tree, + ['image', 'definition'], + // @ts-expect-error Types Should be correct here + (node, ancestors: Array) => { + let url + const originalUrl = node.url - if (isInUDR) { - let domain + /** + * The Definition node could be used by an image or link reference + * This regex checks if the path starts with /img or /public/img. While + * a brittle check, it prevents links references from breaking. + * + * We need to follow with a more comprehensive, long-term solution + * to selectively delineate image from link. + */ + const regex = /^\/img|\/public\/img/ // Ensures non-image links aren't rewritten + const isImagePath = regex.test(originalUrl) - if (process.env.NODE_ENV === 'development') { - domain = `http://localhost:${process.env.UNIFIED_DOCS_PORT}` - } else { - domain = process.env.UNIFIED_DOCS_API - } + if (isImagePath) { + if (isInUDR) { + let domain - url = new URL(`${domain}/api/assets/${product}/${version}${node.url}`) - } else { - const asset = path.posix.join(...getAssetPathParts(originalUrl)) + if (process.env.NODE_ENV === 'development') { + domain = `http://localhost:${process.env.UNIFIED_DOCS_PORT}` + } else { + domain = process.env.UNIFIED_DOCS_API + } - url = new URL(`${process.env.MKTG_CONTENT_DOCS_API}/api/assets`) - url.searchParams.append('asset', asset) - url.searchParams.append('version', version) - url.searchParams.append('product', product) - } + url = new URL( + `${domain}/api/assets/${product}/${version}${node.url}` + ) + } else { + const asset = path.posix.join(...getAssetPathParts(originalUrl)) + + url = new URL(`${process.env.MKTG_CONTENT_DOCS_API}/api/assets`) + url.searchParams.append('asset', asset) + url.searchParams.append('version', version) + url.searchParams.append('product', product) + } - node.url = url.toString() - logOnce( - node.url, - `Rewriting asset url for local preview: + node.url = url.toString() + logOnce( + node.url, + `Rewriting asset url for local preview: - Found: ${originalUrl} - Replaced with: ${node.url} If this is a net-new asset, you'll need to commit and push it to GitHub.\n` - ) + ) - // if the image is wrapped in a link, and shares the same url as the original image, then update the link's url to the new asset url - if (isInUDR) { - const parent = ancestors[ancestors.length - 1] - if (parent && parent.type === 'link' && parent.url === originalUrl) { - parent.url = url.toString() + // if the image is wrapped in a link, and shares the same url as the original image, then update the link's url to the new asset url + if (isInUDR) { + const parent = ancestors[ancestors.length - 1] + if ( + parent && + parent.type === 'link' && + parent.url === originalUrl + ) { + parent.url = url.toString() + } + } } } - }) + ) } } } From 2e2f774f3d232170b5f317903c4f0dfe077626fc Mon Sep 17 00:00:00 2001 From: William Dalessandro Date: Wed, 15 Oct 2025 14:55:18 -0400 Subject: [PATCH 5/5] adding in repo and path references for specs --- src/pages/hcp/api-docs/consul/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/hvn/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/identity/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/operations/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/packer/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/rbac/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/vagrant-box-registry/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/vault-secrets/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/vault/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/waypoint/[[...page]].tsx | 4 ++-- src/pages/hcp/api-docs/webhook/[[...page]].tsx | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/pages/hcp/api-docs/consul/[[...page]].tsx b/src/pages/hcp/api-docs/consul/[[...page]].tsx index 1eaf840b61..d4aaed27e7 100644 --- a/src/pages/hcp/api-docs/consul/[[...page]].tsx +++ b/src/pages/hcp/api-docs/consul/[[...page]].tsx @@ -36,8 +36,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { serviceProductSlug: 'consul', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-global-network-manager-service', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-global-network-manager-service', ref: 'main', }, statusIndicatorConfig: { diff --git a/src/pages/hcp/api-docs/hvn/[[...page]].tsx b/src/pages/hcp/api-docs/hvn/[[...page]].tsx index dcbe44cfd4..eab69a96d1 100644 --- a/src/pages/hcp/api-docs/hvn/[[...page]].tsx +++ b/src/pages/hcp/api-docs/hvn/[[...page]].tsx @@ -33,8 +33,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { basePath: '/hcp/api-docs/hvn', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-network', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-network', ref: 'main', }, groupOperationsByPath: true, diff --git a/src/pages/hcp/api-docs/identity/[[...page]].tsx b/src/pages/hcp/api-docs/identity/[[...page]].tsx index e63c4d6c8b..fbd75a8bc2 100644 --- a/src/pages/hcp/api-docs/identity/[[...page]].tsx +++ b/src/pages/hcp/api-docs/identity/[[...page]].tsx @@ -33,8 +33,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { basePath: '/hcp/api-docs/identity', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-iam', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-iam', ref: 'main', }, groupOperationsByPath: true, diff --git a/src/pages/hcp/api-docs/operations/[[...page]].tsx b/src/pages/hcp/api-docs/operations/[[...page]].tsx index 6c0a693459..6eada857aa 100644 --- a/src/pages/hcp/api-docs/operations/[[...page]].tsx +++ b/src/pages/hcp/api-docs/operations/[[...page]].tsx @@ -33,8 +33,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { basePath: '/hcp/api-docs/operations', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-operation', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-operation', ref: 'main', }, groupOperationsByPath: true, diff --git a/src/pages/hcp/api-docs/packer/[[...page]].tsx b/src/pages/hcp/api-docs/packer/[[...page]].tsx index dc8dbb0266..502ae4e6c3 100644 --- a/src/pages/hcp/api-docs/packer/[[...page]].tsx +++ b/src/pages/hcp/api-docs/packer/[[...page]].tsx @@ -35,8 +35,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { serviceProductSlug: 'packer', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-packer-service', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-packer-service', ref: 'main', }, statusIndicatorConfig: { diff --git a/src/pages/hcp/api-docs/rbac/[[...page]].tsx b/src/pages/hcp/api-docs/rbac/[[...page]].tsx index 7fb7913500..cd1f2f7928 100644 --- a/src/pages/hcp/api-docs/rbac/[[...page]].tsx +++ b/src/pages/hcp/api-docs/rbac/[[...page]].tsx @@ -33,8 +33,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { productSlug: 'hcp', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-resource-manager', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-resource-manager', ref: 'main', }, navResourceItems: [ diff --git a/src/pages/hcp/api-docs/vagrant-box-registry/[[...page]].tsx b/src/pages/hcp/api-docs/vagrant-box-registry/[[...page]].tsx index 49ccadbec4..9eb07754f9 100644 --- a/src/pages/hcp/api-docs/vagrant-box-registry/[[...page]].tsx +++ b/src/pages/hcp/api-docs/vagrant-box-registry/[[...page]].tsx @@ -34,8 +34,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { basePath: '/hcp/api-docs/vagrant-box-registry', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-vagrant-box-registry', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-vagrant-box-registry', ref: 'main', }, groupOperationsByPath: true, diff --git a/src/pages/hcp/api-docs/vault-secrets/[[...page]].tsx b/src/pages/hcp/api-docs/vault-secrets/[[...page]].tsx index ab75dc35c3..567be27d4e 100644 --- a/src/pages/hcp/api-docs/vault-secrets/[[...page]].tsx +++ b/src/pages/hcp/api-docs/vault-secrets/[[...page]].tsx @@ -49,8 +49,8 @@ const PAGE_CONFIG: OpenApiDocsViewV2Config = { ], schemaSource: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-vault-secrets', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-vault-secrets', ref: 'main', }, productContext: 'hcp', diff --git a/src/pages/hcp/api-docs/vault/[[...page]].tsx b/src/pages/hcp/api-docs/vault/[[...page]].tsx index d87376bc0c..8d9dd9fb56 100644 --- a/src/pages/hcp/api-docs/vault/[[...page]].tsx +++ b/src/pages/hcp/api-docs/vault/[[...page]].tsx @@ -49,8 +49,8 @@ const PAGE_CONFIG: OpenApiDocsViewV2Config = { ], schemaSource: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-vault-service', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-vault-service', ref: 'main', }, productContext: 'hcp', diff --git a/src/pages/hcp/api-docs/waypoint/[[...page]].tsx b/src/pages/hcp/api-docs/waypoint/[[...page]].tsx index 2500c769c8..7228b20633 100644 --- a/src/pages/hcp/api-docs/waypoint/[[...page]].tsx +++ b/src/pages/hcp/api-docs/waypoint/[[...page]].tsx @@ -30,8 +30,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { basePath: '/hcp/api-docs/waypoint', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-waypoint-service', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-waypoint-service', ref: 'main', }, groupOperationsByPath: true, diff --git a/src/pages/hcp/api-docs/webhook/[[...page]].tsx b/src/pages/hcp/api-docs/webhook/[[...page]].tsx index 2d311338c1..4fb8169256 100644 --- a/src/pages/hcp/api-docs/webhook/[[...page]].tsx +++ b/src/pages/hcp/api-docs/webhook/[[...page]].tsx @@ -29,8 +29,8 @@ const PAGE_CONFIG: OpenApiDocsPageConfig = { productSlug: 'hcp', githubSourceDirectory: { owner: 'hashicorp', - repo: 'hcp-specs', - path: 'specs/cloud-webhook', + repo: 'web-unified-docs', + path: 'content/hcp-docs/specs/cloud-webhook', ref: 'main', }, statusIndicatorConfig: {