fix(api): render children listing on API section index pages

Update Hugo templates to correctly display API children listing on
section index pages (/influxdb3/core/api/, /influxdb3/enterprise/api/)
instead of the RapiDoc renderer.

- Create layouts/api/section.html for API section pages
- Update layouts/_default/api.html to detect section pages and render
  content directly instead of using RapiDoc
- Clean up layouts/api/list.html debug comment

The issue was that layouts/_default/api.html took precedence over
layouts/api/list.html for section pages due to Hugo's type-based
template lookup. The fix adds .IsSection check to delegate section
pages to appropriate rendering logic.
claude/fix-docs-build-issue-VL3Et
Jason Stirnaman 2025-12-31 14:41:44 -06:00
parent ec5a9c150c
commit 59daf1733d
3 changed files with 110 additions and 5 deletions

View File

@ -1,13 +1,61 @@
{{/*
API Documentation Default Layout
Full page layout for API documentation using the renderer abstraction.
The renderer (Scalar or RapiDoc) is selected via site.Params.apiRenderer.
Fallback layout for API documentation pages.
Delegates to appropriate templates based on page type:
- Section pages: Use section.html logic (children listing)
- Pages with staticFilePath: Use RapiDoc renderer
Required frontmatter:
- staticFilePath: Path to the OpenAPI specification file
Note: This template exists as a catch-all but specific templates
(api/section.html, api/list.html, api/single.html) should be preferred.
*/}}
{{/* Section pages should render content directly, not use RapiDoc */}}
{{ if .IsSection }}
{{ partial "header.html" . }}
{{ partial "topnav.html" . }}
<div class="page-wrapper">
{{ partial "sidebar.html" . }}
<div class="content-wrapper api-content">
<div class="api-main">
<article class="article article--content api-reference" role="main">
<header class="article--header">
<h1 class="article--title">{{ .Title }}</h1>
{{ with .Description }}
<p class="article--description">{{ . }}</p>
{{ end }}
</header>
{{/* SECTION INDEX - Show page content (intro + children listing) */}}
{{ with .Content }}
<section class="api-section-content">
{{ . }}
</section>
{{ else }}
{{/* Fallback to partial if no content */}}
{{ partial "api/section-children.html" . }}
{{ end }}
{{ partial "article/related.html" . }}
</article>
</div>
<aside class="api-toc" data-component="api-toc">
<h4 class="api-toc-header">ON THIS PAGE</h4>
<nav class="api-toc-nav"></nav>
</aside>
</div>
</div>
{{ partial "footer.html" . }}
{{ else }}
{{/* Non-section pages with staticFilePath use RapiDoc renderer */}}
{{ partial "header.html" . }}
{{ partial "topnav.html" . }}
@ -31,3 +79,5 @@
</div>
{{ partial "footer.html" . }}
{{ end }}

View File

@ -28,8 +28,15 @@
{{ $hasTag := isset .Params "tag" }}
{{ if not $hasTag }}
{{/* SECTION INDEX - Show tag pages from article data */}}
{{/* SECTION INDEX - Show page content (intro + children listing) */}}
{{ with .Content }}
<section class="api-section-content">
{{ . }}
</section>
{{ else }}
{{/* Fallback to partial if no content */}}
{{ partial "api/section-children.html" . }}
{{ end }}
{{ else }}
{{/* TAG PAGE - Show operations or conceptual content */}}

48
layouts/api/section.html Normal file
View File

@ -0,0 +1,48 @@
{{/*
API Documentation Section Layout
Used for API section index pages (e.g., /influxdb3/core/api/).
Shows page content with children listing instead of RapiDoc renderer.
For tag pages (with 'tag' param), Hugo uses list.html instead.
*/}}
{{ partial "header.html" . }}
{{ partial "topnav.html" . }}
<div class="page-wrapper">
{{ partial "sidebar.html" . }}
<div class="content-wrapper api-content">
<div class="api-main">
<article class="article article--content api-reference" role="main">
<header class="article--header">
<h1 class="article--title">{{ .Title }}</h1>
{{ with .Description }}
<p class="article--description">{{ . }}</p>
{{ end }}
</header>
{{/* SECTION INDEX - Show page content (intro + children listing) */}}
{{ with .Content }}
<section class="api-section-content">
{{ . }}
</section>
{{ else }}
{{/* Fallback to partial if no content */}}
{{ partial "api/section-children.html" . }}
{{ end }}
{{ partial "article/related.html" . }}
</article>
</div>
<aside class="api-toc" data-component="api-toc">
<h4 class="api-toc-header">ON THIS PAGE</h4>
<nav class="api-toc-nav"></nav>
</aside>
</div>
</div>
{{ partial "footer.html" . }}