-
Notifications
You must be signed in to change notification settings - Fork 321
fix(ci): add path offset for PR preview subdirectory baseURL #6665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
When PR preview builds use a subdirectory baseURL like /docs-v2/pr-preview/pr-XXXX/, shortcodes that parse .RelPermalink to detect product context fail because the path has extra segments. This fix: - Adds config/pr-preview/params.yml with prPreviewPathOffset: 3 - Updates workflow to use -e pr-preview environment - Updates api-endpoint, influxdb/host, and children shortcodes to use the offset when indexing path segments - Adds nil-safety with default fallback for placeholder_host Normal builds are unaffected (offset defaults to 0).
Contributor
PR PreviewPreview skippedNo pages to preview (content removed) Checked: 2025-12-22 16:13:52 UTC |
jstirnaman
added a commit
that referenced
this pull request
Dec 22, 2025
Apply the same prPreviewPathOffset fix to product-name.html and sidebar.html that was applied in the initial PR #6665. These templates parse RelPermalink to detect product context, but when baseURL includes a subdirectory path (e.g., /docs-v2/pr-preview/pr-XXXX/), the path indices shift. This fix uses the configurable offset to skip extra path segments in PR preview builds.
3 tasks
jstirnaman
added a commit
that referenced
this pull request
Dec 22, 2025
When PR preview builds use a subdirectory baseURL like /docs-v2/pr-preview/pr-XXXX/, shortcodes that parse .RelPermalink to detect product context fail because the path has extra segments. This fix: - Adds config/pr-preview/params.yml with prPreviewPathOffset: 3 - Updates workflow to use -e pr-preview environment - Updates api-endpoint, influxdb/host, and children shortcodes to use the offset when indexing path segments - Adds nil-safety with default fallback for placeholder_host Normal builds are unaffected (offset defaults to 0).
jstirnaman
added a commit
that referenced
this pull request
Dec 22, 2025
* fix(ci): add path offset for PR preview subdirectory baseURL When PR preview builds use a subdirectory baseURL like /docs-v2/pr-preview/pr-XXXX/, shortcodes that parse .RelPermalink to detect product context fail because the path has extra segments. This fix: - Adds config/pr-preview/params.yml with prPreviewPathOffset: 3 - Updates workflow to use -e pr-preview environment - Updates api-endpoint, influxdb/host, and children shortcodes to use the offset when indexing path segments - Adds nil-safety with default fallback for placeholder_host Normal builds are unaffected (offset defaults to 0). * fix(ci): add path offset to product-name and sidebar for PR previews Apply the same prPreviewPathOffset fix to product-name.html and sidebar.html that was applied in the initial PR #6665. These templates parse RelPermalink to detect product context, but when baseURL includes a subdirectory path (e.g., /docs-v2/pr-preview/pr-XXXX/), the path indices shift. This fix uses the configurable offset to skip extra path segments in PR preview builds. * fix(ci): skip PR preview for fork PRs and add notice comment Fork PRs cannot deploy to gh-pages because GITHUB_TOKEN has read-only access to the base repository. This is a GitHub security feature. Changes: - Add condition to skip preview job for fork PRs - Add fork-notice job to post helpful comment explaining limitation - Include local preview instructions for contributors
jstirnaman
added a commit
that referenced
this pull request
Dec 29, 2025
When PR preview builds use a subdirectory baseURL like /docs-v2/pr-preview/pr-XXXX/, shortcodes that parse .RelPermalink to detect product context fail because the path has extra segments. This fix: - Adds config/pr-preview/params.yml with prPreviewPathOffset: 3 - Updates workflow to use -e pr-preview environment - Updates api-endpoint, influxdb/host, and children shortcodes to use the offset when indexing path segments - Adds nil-safety with default fallback for placeholder_host Normal builds are unaffected (offset defaults to 0).
jstirnaman
added a commit
that referenced
this pull request
Jan 2, 2026
When PR preview builds use a subdirectory baseURL like /docs-v2/pr-preview/pr-XXXX/, shortcodes that parse .RelPermalink to detect product context fail because the path has extra segments. This fix: - Adds config/pr-preview/params.yml with prPreviewPathOffset: 3 - Updates workflow to use -e pr-preview environment - Updates api-endpoint, influxdb/host, and children shortcodes to use the offset when indexing path segments - Adds nil-safety with default fallback for placeholder_host Normal builds are unaffected (offset defaults to 0).
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.
Summary
Fixes PR preview build failures caused by subdirectory baseURL breaking product detection in shortcodes.
Changes
config/pr-preview/params.yml- New Hugo environment config withprPreviewPathOffset: 3.github/workflows/pr-preview.yml- Added-e pr-previewto Hugo build commandFixes the preview failure in #6657.
Related: Broader architectural fix in draft PR #6664.