Skip to content

fix(ci): add path offset for PR preview subdirectory baseURL#6662

Merged
jstirnaman merged 2 commits intomasterfrom
ci-pr-preview
Dec 22, 2025
Merged

fix(ci): add path offset for PR preview subdirectory baseURL#6662
jstirnaman merged 2 commits intomasterfrom
ci-pr-preview

Conversation

@jstirnaman
Copy link
Contributor

@jstirnaman jstirnaman commented 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).

Tested default port in influxdb3 code blocks.

A more complete fix would be to replace the reliance on .RelPermalink with .File.Dir in templates, so the path doesn't isn't affected by the deployment context. I'll open a separate branch/PR for it, because it's a significant change that requires comprehensive testing.

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 jstirnaman merged commit 74c33e9 into master Dec 22, 2025
5 checks passed
@jstirnaman jstirnaman deleted the ci-pr-preview branch December 22, 2025 16:03
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 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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant