content/ directory.
Prerequisites
- Node.js 22 or later
- The GitHub CLI (
gh) authenticated with an account that has read access to the product repository - Sufficient disk space for cloning the product repository (can be several GB for large products)
Step 1: Add the product to productConfig.mjs
OpenproductConfig.mjs and add an entry for the product. Each entry defines how the migration script locates content, assets, and navigation data within the product repository.
| Field | Type | Description |
|---|---|---|
assetDir | string | string[] | Directory (or directories) containing images and other assets within websiteDir |
basePaths | string[] | URL path prefixes where this product’s docs appear on developer.hashicorp.com |
contentDir | string | Directory containing .mdx files within websiteDir |
dataDir | string | Directory containing *-nav-data.json files within websiteDir |
navDataPath | string | Optional path prefix for nav data, used when it differs from productSlug |
productSlug | string | Slug used in API routes (/api/content/<productSlug>/...) |
semverCoerce | Function | Function to coerce version strings into semver objects for sorting |
supportsExclusionDirectives | boolean | Whether the product uses content exclusion directives |
versionedDocs | boolean | true for products with multiple versions; false for single-version products |
websiteDir | string | Root directory of all docs content within the cloned product repository |
Step 2: Run the migration script
The migration script clones the product repository, checks out each versioned git ref, and extracts content intocontent/ and assets into public/assets/.
.content-source-repos/. This directory can be deleted after the migration completes.
Expected output structure after migration:
The script contacts the existing
content.hashicorp.com API to determine which git refs correspond to the versions currently live on developer.hashicorp.com. An internet connection is required during migration.Step 3: Verify the migration locally
Wait for the API to finish processing
Visit
http://localhost:8080/api/all-docs-paths and confirm that paths for your product appear in the response.Test content endpoints
Fetch a specific document from the API and compare it to the response from the existing content API:
Step 4: Run the broken link checker
Before submitting the migration PR, check for broken links in the migrated content.Step 5: Submit the migration PR
Step 6: Post-migration steps
After the migration PR is merged:Add the contributor notice to the original repo
Run See Update MDX files for full details.
update-mdx-files.sh against the product repository’s docs directory to add a notice redirecting contributors to web-unified-docs:Submit a PR to the product repository
Open a PR to the product repository with the updated MDX files containing the contributor notice. This communicates to contributors that future changes should be made in web-unified-docs.
Troubleshooting
Content not found for older versions
Content not found for older versions
Some products stored content in a
pages/ directory in older versions rather than content/. The migration script may fail with an error like my-product/website/content: No such file or directory for these older versions.This is a known edge case. Check the comments in productConfig.mjs for the specific product to see which versions are affected. You may need to skip those versions or handle them manually.Script does not exit after completing
Script does not exit after completing
The migration script may hang after printing the completion message when
gh repo clone commands are used. This is a known issue related to child process handling. If you see ✅ Finished migrating all target repos and versions. but the script has not exited, you can safely terminate it with Ctrl+C.Force overwriting existing content
Force overwriting existing content
If you need to re-run the migration to overwrite previously migrated content, pass the
-force flag: