docs-v2/layouts/api/list.html

225 lines
7.2 KiB
HTML

{{/* API Documentation Layout Handles two cases: 1. Section index (no 'tag'
param) - shows list of tag pages from article data 2. Tag pages (has 'tag'
param) - shows RapiDoc with all operations for the tag For conceptual pages
(isConceptual: true), shows content without operations. */}}
{{/* Extract product and version from URL for download buttons */}}
{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }}
{{ $product := index $productPathData 0 }}
{{ $version := index $productPathData 1 }}
<!-- USING_API_LIST_HTML_TEMPLATE -->
{{ 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>
{{/* 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 }}
<p class="article--description">{{ . }}</p>
{{ end }} {{ end }}
</header>
{{/* 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") }}
<div class="api-spec-actions api-spec-actions--dual">
<a href="/openapi/influxdb-{{ $version }}-v2-data-api.yml" 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 Data API Spec
</a>
<a href="/openapi/influxdb-{{ $version }}-management-api.yml" 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 Management API Spec
</a>
</div>
{{ end }}
{{ with .Content }}
<section class="api-section-content">{{ . }}</section>
{{ 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 */}}
<section class="api-conceptual-content">
{{ with .Content }} {{ . }} {{ else }} {{ with .Params.tagDescription
}} {{ . | markdownify }} {{ end }} {{ end }}
</section>
{{ else }} {{/* Operational Page - Show RapiDoc with all operations */}}
{{/* Note: Description is shown in the RapiDoc info section from the
spec */}} {{/* Hugo page content if any (for custom intro content) */}}
{{ with .Content }}
<section class="api-content-body">{{ . }}</section>
{{ end }} {{/* RapiDoc renders all operations for this tag */}} {{ with
.Params.staticFilePath }}
<section class="api-operations-section">
{{ partial "api/rapidoc-tag.html" $ }}
</section>
{{ end }} {{ end }} {{ end }} {{ partial "article/related.html" . }}
</article>
</div>
{{/* ON THIS PAGE TOC - Generated from operations array */}} {{ $operations
:= .Params.operations }} {{ $hasTag := isset .Params "tag" }} {{
$isConceptual := .Params.isConceptual | default false }} {{ if and $hasTag
(not $isConceptual) }}
<aside class="api-toc" data-component="api-toc">
<h4 class="api-toc-header">ON THIS PAGE</h4>
<nav class="api-toc-nav">
{{/* Operation links - use RapiDoc anchor format: {method}-{path} Use
safeURL to prevent URL-encoding of slashes Show method badge +
human-readable summary (not path) */}} {{ range $operations }} {{
$anchor := printf "#%s-%s" (lower .method) .path }}
<a
href="{{ $anchor | safeURL }}"
class="api-toc-link api-toc-link--operation"
>
<span
class="api-method api-method--{{ lower .method }} api-method--small"
>{{ upper .method }}</span
>
<span class="api-toc-summary"
>{{ with .summary }}{{ . }}{{ else }}{{ .path }}{{ end }}</span
>
</a>
{{ end }}
</nav>
</aside>
{{ else }}
<aside class="api-toc" data-component="api-toc">
<h4 class="api-toc-header">ON THIS PAGE</h4>
<nav class="api-toc-nav"></nav>
</aside>
{{ end }}
</div>
</div>
{{ partial "footer.html" . }}
<style>
/* API TOC styling */
.api-toc {
position: sticky;
top: 80px;
max-height: calc(100vh - 100px);
overflow-y: auto;
padding: 1rem;
width: 280px;
flex-shrink: 0;
}
.api-toc-header {
font-size: 0.75rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.05em;
color: #545667;
margin: 0 0 0.75rem 0;
}
.api-toc-nav {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.api-toc-link {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.375rem 0.5rem;
font-size: 0.85rem;
color: #545667;
text-decoration: none;
border-radius: 4px;
transition:
background-color 0.15s,
color 0.15s;
}
.api-toc-link:hover {
background-color: rgba(0, 163, 255, 0.08);
color: #00a3ff;
}
.api-toc-link--operation {
/* Use default font for human-readable summaries */
}
.api-toc-summary {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.8rem;
}
/* Small method badges for TOC */
.api-method--small {
font-size: 0.65rem;
padding: 0.125rem 0.375rem;
flex-shrink: 0;
}
/* Dark mode */
[data-theme='dark'] .api-toc-header,
html:has(link[title='dark-theme']:not([disabled])) .api-toc-header {
color: #9ea0a6;
}
[data-theme='dark'] .api-toc-link,
html:has(link[title='dark-theme']:not([disabled])) .api-toc-link {
color: #b4b6bc;
}
[data-theme='dark'] .api-toc-link:hover,
html:has(link[title='dark-theme']:not([disabled])) .api-toc-link:hover {
background-color: rgba(0, 163, 255, 0.15);
color: #00a3ff;
}
/* Responsive - hide TOC on smaller screens */
@media (max-width: 1200px) {
.api-toc {
display: none;
}
}
/* 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;
}
}
</style>