Skip to content

Conversation

@jstirnaman
Copy link
Contributor

Summary

Architectural fix for product detection in shortcodes - uses .File.Dir instead of .RelPermalink to make product detection independent of baseURL configuration.

Problem

Shortcodes parse .RelPermalink to determine product context, but when baseURL includes a path (e.g., for PR previews at /docs-v2/pr-preview/pr-XXXX/), the path segments shift and product detection fails.

Solution

Creates a centralized product-info.html partial that extracts product/version from .File.Dir (the content file's directory path), which is unaffected by baseURL configuration.

Changes

  • layouts/partials/product-info.html - New partial for baseURL-independent product detection
  • layouts/shortcodes/api-endpoint.html - Uses new partial
  • layouts/shortcodes/influxdb/host.html - Uses new partial
  • layouts/shortcodes/children.html - Uses new partial

Benefits

  • Works regardless of baseURL configuration
  • Centralized logic (DRY)
  • Could be extended to fix ~20+ other templates using the same vulnerable pattern

Test plan

  • Full site build passes
  • PR preview builds work
  • Product detection works correctly across all products
  • Review impact on other templates that use .RelPermalink for product detection

Note: This is the broader architectural fix for later testing. A localized workaround for PR previews is in the ci-pr-preview branch.

Create centralized product-info.html partial that extracts product/version
from .File.Dir instead of .RelPermalink. This ensures product detection
works correctly regardless of baseURL configuration, including PR preview
deployments at subdirectory paths.

Updated shortcodes:
- api-endpoint.html
- influxdb/host.html
- children.html
@jstirnaman jstirnaman added hold off Should not be merged or address yet Research Phase Initial research and discovery phase ui labels Dec 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hold off Should not be merged or address yet Research Phase Initial research and discovery phase ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants