21 lines
1.4 KiB
HTML
21 lines
1.4 KiB
HTML
{{- $productPathData := findRE "[^/]+.*?" .Page.RelPermalink -}}
|
|
{{- $currentVersion := index $productPathData 1 -}}
|
|
{{- $endpoint := .Get "endpoint" -}}
|
|
{{- $isOSS := ne (len (findRE `^v[0-9]` $currentVersion)) 0 -}}
|
|
{{- $parsedProductKey := cond $isOSS "oss" $currentVersion -}}
|
|
{{- $productKey := .Get "influxdb_host" | default $parsedProductKey -}}
|
|
{{- $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" -}}
|
|
{{- $productRef := index $productAliases $productKey -}}
|
|
{{- $productData := index .Site.Data.products $productRef -}}
|
|
{{- $placeholderHost := $productData.placeholder_host }}
|
|
{{- $method := .Get "method" | upper -}}
|
|
{{- $methodStyle := .Get "method" | lower -}}
|
|
{{- $apiRef := .Get "api-ref" | default "" -}}
|
|
{{- $renderedEndpoint := $endpoint | replaceRE `\{\{[<%] influxdb/host .*[>%]\}\}` $placeholderHost -}}
|
|
<pre class="api-endpoint">
|
|
{{- if ne $apiRef "" -}}
|
|
<a href="{{ $apiRef }}" target="_blank"><span class="api {{ $methodStyle }}">{{ $method }}</span> {{ $renderedEndpoint }}</a>
|
|
{{- else -}}
|
|
<span class="api {{ $methodStyle }}">{{ $method }}</span> {{ $renderedEndpoint }}
|
|
{{- end -}}
|
|
</pre> |