File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9090 PREVIEW_BASE_URL : https://influxdata.github.io/docs-v2/pr-preview/pr-${{ github.event.number }}/
9191 run : |
9292 START_TIME=$(date +%s)
93- npx hugo --minify --baseURL "$PREVIEW_BASE_URL"
93+ # Use pr-preview environment for path offset config
94+ npx hugo --minify --baseURL "$PREVIEW_BASE_URL" -e pr-preview
9495 END_TIME=$(date +%s)
9596 DURATION=$((END_TIME - START_TIME))
9697 echo "build-time=${DURATION}s" >> $GITHUB_OUTPUT
Original file line number Diff line number Diff line change 1+ # PR Preview environment parameters
2+ # Used when building with: npx hugo -e pr-preview
3+
4+ # Number of path segments to skip when parsing RelPermalink for product detection
5+ # For baseURL like https://influxdata.github.io/docs-v2/pr-preview/pr-6657/
6+ # The path has 3 extra segments: docs-v2, pr-preview, pr-XXXX
7+ # Workaround to correctly detect products in preview builds for Hugo templates relying on relPermalink to set active product
8+ prPreviewPathOffset : 3
Original file line number Diff line number Diff line change 11{{- $productPathData := findRE "[^/]+.*?" .Page.RelPermalink -}}
2- {{- $currentVersion := index $productPathData 1 -}}
2+ {{- /* Support deployments (such as CI tools) with subdirectory baseURL */ -}}
3+ {{- $pathOffset := .Site.Params.prPreviewPathOffset | default 0 -}}
4+ {{- $currentVersion := index $productPathData (add $pathOffset 1) -}}
35{{- $endpoint := .Get "endpoint" -}}
46{{- $isOSS := ne (len (findRE `^v[0-9]` $currentVersion)) 0 -}}
57{{- $parsedProductKey := cond $isOSS "oss" $currentVersion -}}
68{{- $productKey := .Get "influxdb_host" | default $parsedProductKey -}}
79{{- $productAliases := dict "oss" "influxdb" "cloud" "influxdb_cloud" "cloud-tsm" "influxdb_cloud" "core" "influxdb3_core" "enterprise" "influxdb3_enterprise" "cloud-serverless" "influxdb3_cloud_serverless" "serverless" "influxdb3_cloud_serverless" "cloud-dedicated" "influxdb3_cloud_dedicated" "dedicated" "influxdb3_cloud_dedicated" "clustered" "influxdb3_clustered" -}}
810{{- $productRef := index $productAliases $productKey -}}
9- {{- $productData := index .Site.Data.products $productRef -}}
10- {{- $placeholderHost := $productData.placeholder_host }}
11+ {{- $productData := dict -}}
12+ {{- with $productRef }}{{- $productData = index $.Site.Data.products . | default dict -}}{{- end -}}
13+ {{- $placeholderHost := $productData.placeholder_host | default "localhost:8086" }}
1114{{- $method := .Get "method" | upper -}}
1215{{- $methodStyle := .Get "method" | lower -}}
1316{{- $apiRef := .Get "api-ref" | default "" -}}
Original file line number Diff line number Diff line change 4242 {{ end }}
4343 {{ end }}
4444 {{ if .Params.list_code_example }}
45- {{- $productPathData := findRE "[^/]+.*?" .Page.RelPermalink -}}
46- {{- $currentVersion := index $productPathData 1 -}}
45+ {{- $productPathData := findRE "[^/]+.*?" $.Page.RelPermalink -}}
46+ {{- /* Support deployments (such as CI tools) with subdirectory baseURL */ -}}
47+ {{- $pathOffset := $.Site.Params.prPreviewPathOffset | default 0 -}}
48+ {{- $currentVersion := index $productPathData (add $pathOffset 1) -}}
4749 {{- $isOSS := ne (len (findRE `^v[0-9]` $currentVersion)) 0 -}}
4850 {{- $productKey := cond $isOSS "oss" $currentVersion -}}
4951 {{- $productAliases := dict "oss" "influxdb" "core" "influxdb3_core" "enterprise" "influxdb3_enterprise" "cloud" "influxdb_cloud" "cloud-tsm" "influxdb_cloud" "cloud-serverless" "influxdb3_cloud_serverless" "serverless" "influxdb3_cloud_serverless" "cloud-dedicated" "influxdb3_cloud_dedicated" "dedicated" "influxdb3_cloud_dedicated" "clustered" "influxdb3_clustered" -}}
5052 {{- $productRef := index $productAliases $productKey -}}
51- {{- $productData := index .Site.Data.products $productRef -}}
52- {{- $placeholderHost := $productData.placeholder_host }}
53+ {{- $productData := dict -}}
54+ {{- with $productRef }}{{- $productData = index $.Site.Data.products . | default dict -}}{{- end -}}
55+ {{- $placeholderHost := $productData.placeholder_host | default "localhost:8086" }}
5356 {{ .Params.list_code_example | replaceRE `\{\{[< \%] influxdb/host [> %]\}\}` $placeholderHost | .RenderString }}
5457 {{ end }}
5558
Original file line number Diff line number Diff line change 11{{- $productPathData := findRE "[^/]+.*?" .Page.RelPermalink -}}
2- {{- $currentVersion := index $productPathData 1 -}}
2+ {{- /* Support deployments (such as CI tools) with subdirectory baseURL */ -}}
3+ {{- $pathOffset := .Site.Params.prPreviewPathOffset | default 0 -}}
4+ {{- $currentVersion := index $productPathData (add $pathOffset 1) -}}
35{{- $isOSS := ne (len (findRE `^v[0-9]` $currentVersion)) 0 -}}
46{{- $parsedProductKey := cond $isOSS "oss" $currentVersion -}}
57{{- $productKey := .Get 0 | default $parsedProductKey -}}
68{{- $productAliases := dict "oss" "influxdb" "cloud" "influxdb_cloud" "cloud-tsm" "influxdb_cloud" "core" "influxdb3_core" "enterprise" "influxdb3_enterprise" "cloud-serverless" "influxdb3_cloud_serverless" "serverless" "influxdb3_cloud_serverless" "cloud-dedicated" "influxdb3_cloud_dedicated" "dedicated" "influxdb3_cloud_dedicated" "clustered" "influxdb3_clustered" -}}
79{{- $productRef := index $productAliases $productKey -}}
8- {{- $productData := index .Site.Data.products $productRef -}}
9- {{ $productData.placeholder_host }}
10+ {{- $productData := dict -}}
11+ {{- with $productRef }}{{- $productData = index $.Site.Data.products . | default dict -}}{{- end -}}
12+ {{ $productData.placeholder_host | default "localhost:8086" }}
You can’t perform that action at this time.
0 commit comments