{{ .Title }}

- {{/* Only show description in header for section index pages, not tag - pages */}} {{/* Tag pages show their full description in the Overview - section below */}} {{ if not (isset .Params "tag") }} {{ with - .Description }} -

{{ . }}

- {{ end }} {{ end }} + {{/* Only show description in header for section index pages */}} + {{ if not (isset .Params "tag") }} + {{ with .Description }} +

{{ . }}

+ {{ end }} + {{ end }}
- {{/* Check if this is a section index (no tag param) or a tag page */}} - {{ $hasTag := isset .Params "tag" }} {{ if not $hasTag }} {{/* SECTION - INDEX - Show intro content then tag-based children */}} - - {{/* Dual download buttons for Clustered and Cloud Dedicated */}} - {{ if or (eq $version "clustered") (eq $version "cloud-dedicated") }} - - {{ end }} + {{ $hasTag := isset .Params "tag" }} + {{ if not $hasTag }} + {{/* SECTION INDEX - Show intro content then tag-based children */}} {{ with .Content }}
{{ . }}
- {{ end }} {{/* Always show tag pages from article data */}} {{ partial - "api/section-children.html" . }} {{ else }} {{/* TAG PAGE - Show - operations or conceptual content */}} {{ $isConceptual := - .Params.isConceptual | default false }} {{ if $isConceptual }} {{/* - Conceptual Page - Show content directly */}} + {{ end }} + {{ partial "api/section-children.html" . }} + + {{ else }} + {{/* TAG PAGE - Show operations or conceptual content */}} + {{ $isConceptual := .Params.isConceptual | default false }} + {{ if $isConceptual }}
- {{ with .Content }} {{ . }} {{ else }} {{ with .Params.tagDescription - }} {{ . | markdownify }} {{ end }} {{ end }} + {{ with .Content }} {{ . }} {{ else }} + {{ with .Params.tagDescription }}{{ . | markdownify }}{{ end }} + {{ end }}
- {{ else }} {{/* Operational Page - Show all operations */}} - - {{/* Download OpenAPI spec button - context-aware for Clustered/Cloud Dedicated */}} - {{ with .Params.staticFilePath }} - {{/* Extract product name from path like /openapi/influxdb-oss-v2/tags/... */}} - {{ $productName := replaceRE `^/openapi/([^/]+)/.*$` "$1" . }} - - {{/* Check if this is a dual-API product (Clustered or Cloud Dedicated) */}} - {{ $isDualApi := or (strings.Contains $productName "clustered") (strings.Contains $productName "cloud-dedicated") }} - - {{ if $isDualApi }} - {{/* Determine API type from path */}} - {{ $isManagementApi := strings.Contains . "management-api" }} - {{ if $isManagementApi }} - {{ $specPath := printf "/openapi/%s-management-api.yml" $productName }} - {{ else }} - {{ $specPath := printf "/openapi/%s-v2-data-api.yml" $productName }} + {{/* Operational Page - Show all operations */}} + + {{/* Download OpenAPI spec button — uses specDownloadPath from frontmatter */}} + {{ with .Params.specDownloadPath }} - {{ end }} - {{ else }} - {{/* Single-spec products - existing behavior */}} - {{ $completeSpecPath := printf "/openapi/%s.yml" $productName }} - {{ end }} - {{ end }} {{/* Hugo page content if any (for custom intro content) */}} {{ with .Content }} @@ -257,23 +197,4 @@ For conceptual pages (isConceptual: true), shows content without operations. */} } } - /* Dual download buttons container for Clustered/Cloud Dedicated */ - .api-spec-actions--dual { - display: flex; - flex-wrap: wrap; - gap: 0.75rem; - margin: 1rem 0; - } - - /* Responsive - stack buttons on smaller screens */ - @media (max-width: 600px) { - .api-spec-actions--dual { - flex-direction: column; - } - - .api-spec-actions--dual .api-spec-download { - width: 100%; - justify-content: center; - } - } diff --git a/layouts/partials/api/all-endpoints-list.html b/layouts/partials/api/all-endpoints-list.html index 1dd0121e4..5bab0333a 100644 --- a/layouts/partials/api/all-endpoints-list.html +++ b/layouts/partials/api/all-endpoints-list.html @@ -5,50 +5,28 @@ Links point to tag pages with hash anchors (e.g., /api/cache-data/#operation/PostConfigureDistinctCache) Excludes conceptual/trait tag operations. - Uses data from: - - data/article_data/influxdb/{product}/articles.yml + Uses frontmatter params: + - articleDataKey: product data key (e.g., 'influxdb3-core') + - articleSection: section slug (e.g., 'api' or 'management-api') */}} {{ $currentPage := . }} -{{/* Extract product and version from URL */}} -{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} -{{ $product := index $productPathData 0 }} -{{ $version := index $productPathData 1 }} +{{/* Read data key and section from frontmatter */}} +{{ $dataKey := .Params.articleDataKey | default "" }} +{{ $section := .Params.articleSection | default "" }} -{{/* Build data key for article data lookup */}} -{{ $dataKey := "" }} -{{ if eq $product "influxdb3" }} - {{/* Core and Enterprise use influxdb3_ prefix; cloud-* and clustered don't */}} - {{ if or (eq $version "core") (eq $version "enterprise") }} - {{ $dataKey = print "influxdb3_" $version }} - {{ else }} - {{ $dataKey = $version }} - {{ end }} -{{ else if eq $product "influxdb" }} - {{/* Map URL versions to data directory names */}} - {{ if eq $version "v2" }} - {{ $dataKey = "oss-v2" }} - {{ else if eq $version "cloud" }} - {{ $dataKey = "cloud-v2" }} - {{ else if eq $version "v1" }} - {{ $dataKey = "oss-v1" }} - {{ else }} - {{ $dataKey = $version }} - {{ end }} -{{ else if eq $product "enterprise_influxdb" }} - {{ $dataKey = print "enterprise-" $version }} -{{ else }} - {{ $dataKey = $product }} -{{ end }} - -{{/* Get article data for this product */}} +{{/* Get article data using frontmatter-driven lookup */}} {{ $articles := slice }} -{{ with site.Data.article_data }} - {{ with index . "influxdb" }} - {{ with index . $dataKey }} - {{ with index . "articles" }} - {{ with .articles }} - {{ $articles = . }} +{{ if and $dataKey $section }} + {{ with site.Data.article_data }} + {{ with index . "influxdb" }} + {{ with index . $dataKey }} + {{ with index . $section }} + {{ with index . "articles" }} + {{ with .articles }} + {{ $articles = . }} + {{ end }} + {{ end }} {{ end }} {{ end }} {{ end }} @@ -144,7 +122,10 @@ {{ $op := .data.op }} {{ $articlePath := .data.articlePath }} {{/* Build tag page URL with hash anchor: operation/{operationId} */}} - {{ $tagPageUrl := printf "/%s/%s/%s/" $product $version $articlePath }} + {{/* Build tag page URL relative to the section (parent of all-endpoints) */}} + {{ $sectionUrl := $currentPage.Parent.RelPermalink }} + {{ $tagSlug := path.Base $articlePath }} + {{ $tagPageUrl := printf "%s%s/" $sectionUrl $tagSlug }} {{ $hashAnchor := printf "#operation/%s" $op.operationId }} {{ upper $op.method }} @@ -165,7 +146,10 @@ {{ $op := .data.op }} {{ $articlePath := .data.articlePath }} {{/* Build tag page URL with hash anchor: operation/{operationId} */}} - {{ $tagPageUrl := printf "/%s/%s/%s/" $product $version $articlePath }} + {{/* Build tag page URL relative to the section (parent of all-endpoints) */}} + {{ $sectionUrl := $currentPage.Parent.RelPermalink }} + {{ $tagSlug := path.Base $articlePath }} + {{ $tagPageUrl := printf "%s%s/" $sectionUrl $tagSlug }} {{ $hashAnchor := printf "#operation/%s" $op.operationId }} {{ upper $op.method }} @@ -187,7 +171,10 @@ {{ $op := .data.op }} {{ $articlePath := .data.articlePath }} {{/* Build tag page URL with hash anchor: operation/{operationId} */}} - {{ $tagPageUrl := printf "/%s/%s/%s/" $product $version $articlePath }} + {{/* Build tag page URL relative to the section (parent of all-endpoints) */}} + {{ $sectionUrl := $currentPage.Parent.RelPermalink }} + {{ $tagSlug := path.Base $articlePath }} + {{ $tagPageUrl := printf "%s%s/" $sectionUrl $tagSlug }} {{ $hashAnchor := printf "#operation/%s" $op.operationId }} {{ upper $op.method }} @@ -215,7 +202,10 @@ {{ $op := .data.op }} {{ $articlePath := .data.articlePath }} {{/* Build tag page URL with hash anchor: operation/{operationId} */}} - {{ $tagPageUrl := printf "/%s/%s/%s/" $product $version $articlePath }} + {{/* Build tag page URL relative to the section (parent of all-endpoints) */}} + {{ $sectionUrl := $currentPage.Parent.RelPermalink }} + {{ $tagSlug := path.Base $articlePath }} + {{ $tagPageUrl := printf "%s%s/" $sectionUrl $tagSlug }} {{ $hashAnchor := printf "#operation/%s" $op.operationId }} {{ upper $op.method }} diff --git a/layouts/partials/api/section-children.html b/layouts/partials/api/section-children.html index 3ef49d0d4..c217ce5b5 100644 --- a/layouts/partials/api/section-children.html +++ b/layouts/partials/api/section-children.html @@ -4,50 +4,30 @@ Renders tag pages from article data as a children list. Sort order: conceptual tags (traitTags) first, then other tags alphabetically. - Uses data from: - - data/article_data/influxdb/{product}/articles.yml + Uses frontmatter params from generated pages: + - articleDataKey: product data key (e.g., 'influxdb3-core') + - articleSection: section slug (e.g., 'api' or 'management-api') + + Data path: data/article_data/influxdb/{articleDataKey}/{articleSection}/articles.yml */}} {{ $currentPage := . }} -{{/* Extract product and version from URL */}} -{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }} -{{ $product := index $productPathData 0 }} -{{ $version := index $productPathData 1 }} +{{/* Read data key and section from frontmatter */}} +{{ $dataKey := .Params.articleDataKey | default "" }} +{{ $section := .Params.articleSection | default "" }} -{{/* Build data key for article data lookup */}} -{{ $dataKey := "" }} -{{ if eq $product "influxdb3" }} - {{/* Core and Enterprise use influxdb3_ prefix; cloud-* and clustered don't */}} - {{ if or (eq $version "core") (eq $version "enterprise") }} - {{ $dataKey = print "influxdb3_" $version }} - {{ else }} - {{ $dataKey = $version }} - {{ end }} -{{ else if eq $product "influxdb" }} - {{/* Map URL versions to data directory names */}} - {{ if eq $version "v2" }} - {{ $dataKey = "oss-v2" }} - {{ else if eq $version "cloud" }} - {{ $dataKey = "cloud-v2" }} - {{ else if eq $version "v1" }} - {{ $dataKey = "oss-v1" }} - {{ else }} - {{ $dataKey = $version }} - {{ end }} -{{ else if eq $product "enterprise_influxdb" }} - {{ $dataKey = print "enterprise-" $version }} -{{ else }} - {{ $dataKey = $product }} -{{ end }} - -{{/* Get article data for this product */}} +{{/* Get article data using frontmatter-driven lookup */}} {{ $articles := slice }} -{{ with site.Data.article_data }} - {{ with index . "influxdb" }} - {{ with index . $dataKey }} - {{ with index . "articles" }} - {{ with .articles }} - {{ $articles = . }} +{{ if and $dataKey $section }} + {{ with site.Data.article_data }} + {{ with index . "influxdb" }} + {{ with index . $dataKey }} + {{ with index . $section }} + {{ with index . "articles" }} + {{ with .articles }} + {{ $articles = . }} + {{ end }} + {{ end }} {{ end }} {{ end }} {{ end }} @@ -100,7 +80,8 @@ {{ $fields := index . "fields" }} {{ $tag := index $fields "tag" }} {{ $description := index $fields "description" | default "" }} - {{ $tagPageUrl := print "/" $product "/" $version "/" $path "/" | relURL }} + {{/* Build URL relative to the current section page */}} + {{ $tagPageUrl := print $currentPage.RelPermalink (path.Base $path) "/" | relURL }}

{{ $tag }}

{{ with $description }}