140 lines
5.0 KiB
HTML
140 lines
5.0 KiB
HTML
{{/*
|
|
API Documentation Tag/List Layout
|
|
|
|
Displays tag-based API documentation pages with:
|
|
1. Title
|
|
2. Summary (brief description)
|
|
3. Operations list (links to nested operation pages)
|
|
4. Description (detailed content)
|
|
|
|
For conceptual pages (isConceptual: true), shows content without operations list.
|
|
|
|
Required frontmatter:
|
|
- title: Page title
|
|
- description or summary: Brief description
|
|
- operations: Array of operation objects (for non-conceptual pages)
|
|
*/}}
|
|
|
|
{{ partial "header.html" . }}
|
|
{{ partial "topnav.html" . }}
|
|
|
|
<div class="page-wrapper">
|
|
{{/* Left: Existing Hugo sidebar (includes API nav via sidebar.html) */}}
|
|
{{ partial "sidebar.html" . }}
|
|
|
|
{{/* Center + Right: Content and TOC */}}
|
|
<div class="content-wrapper api-content">
|
|
<div class="api-main">
|
|
<article class="article article--content api-reference" role="main">
|
|
<header class="article--header">
|
|
<div class="article--header-row">
|
|
<div class="article--header-text">
|
|
<h1 class="article--title">{{ .Title }}</h1>
|
|
|
|
{{/* Summary - first sentence only at top */}}
|
|
{{ with .Params.summary }}
|
|
<p class="article--summary">{{ . | markdownify }}</p>
|
|
{{ else }}
|
|
{{/* Extract first sentence from description (or full text if no sentence ending) */}}
|
|
{{ with .Description }}
|
|
{{ $matches := findRE `^[^.!?]*[.!?]` . 1 }}
|
|
{{ if gt (len $matches) 0 }}
|
|
{{ $firstSentence := index $matches 0 }}
|
|
<p class="article--summary">{{ $firstSentence | markdownify }}</p>
|
|
{{ else }}
|
|
{{/* No sentence ending found - use first line or full description */}}
|
|
{{ $firstLine := index (split . "\n") 0 }}
|
|
<p class="article--summary">{{ $firstLine | markdownify }}</p>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</div>
|
|
|
|
{{/* Download OpenAPI spec button */}}
|
|
{{ with .Params.staticFilePath }}
|
|
<div class="api-spec-actions">
|
|
<a href="{{ . }}" class="btn api-spec-download" download>
|
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
|
|
<path d="M8 12L3 7h3V2h4v5h3L8 12z"/>
|
|
<path d="M1 14h14v2H1v-2z"/>
|
|
</svg>
|
|
Download OpenAPI Spec
|
|
</a>
|
|
</div>
|
|
{{ end }}
|
|
</div>
|
|
</header>
|
|
|
|
{{ $isConceptual := .Params.isConceptual | default false }}
|
|
|
|
{{ if $isConceptual }}
|
|
{{/* Conceptual Page - Show content directly */}}
|
|
<section class="api-conceptual-content">
|
|
{{ with .Content }}
|
|
{{ . }}
|
|
{{ else }}
|
|
{{ with .Params.tagDescription }}
|
|
{{ . | markdownify }}
|
|
{{ end }}
|
|
{{ end }}
|
|
</section>
|
|
{{ else }}
|
|
{{/* Operational Page - Show operations list then description */}}
|
|
|
|
{{/* Operations List */}}
|
|
{{ $operations := .Params.operations }}
|
|
{{ if $operations }}
|
|
<section class="api-operations-list">
|
|
<h2 id="endpoints">Endpoints</h2>
|
|
<div class="api-operations-grid">
|
|
{{ range $operations }}
|
|
{{/* Build URL: parent section (e.g., /influxdb3/core/api/) + operation path + method */}}
|
|
{{ $apiBase := $.Parent.RelPermalink }}
|
|
{{ $operationURL := printf "%s%s/%s/" $apiBase .path (lower .method) }}
|
|
<a href="{{ $operationURL }}" class="api-operation-card">
|
|
<span class="api-method api-method--{{ lower .method }}">{{ upper .method }}</span>
|
|
<code class="api-path">{{ .path }}</code>
|
|
<span class="api-operation-summary">{{ .summary }}</span>
|
|
</a>
|
|
{{ end }}
|
|
</div>
|
|
</section>
|
|
{{ end }}
|
|
|
|
{{/* Overview - full tag description after endpoints */}}
|
|
{{ $desc := .Description | strings.TrimSpace }}
|
|
{{ if gt (len $desc) 0 }}
|
|
<section class="api-description">
|
|
<h2 id="overview">Overview</h2>
|
|
{{ $desc | markdownify }}
|
|
</section>
|
|
{{ end }}
|
|
|
|
{{/* Hugo page content if any */}}
|
|
{{ with .Content }}
|
|
<section class="api-content-body">
|
|
{{ . }}
|
|
</section>
|
|
{{ end }}
|
|
|
|
{{/* RapiDoc renderer - only for pages with additional content beyond description */}}
|
|
{{/* Don't show RapiDoc on list pages since operations are already shown as cards above */}}
|
|
|
|
{{ end }}
|
|
|
|
{{/* Related documentation links */}}
|
|
{{ partial "article/related.html" . }}
|
|
|
|
</article>
|
|
</div>
|
|
|
|
{{/* Right: Page TOC - "ON THIS PAGE" */}}
|
|
<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" . }}
|