docs-v2/layouts/_default/api.html

113 lines
4.0 KiB
HTML

{{/* API Documentation Default Layout 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 Note: This template exists as a catch-all but specific
templates (api/section.html, api/list.html, api/single.html) should be
preferred. */}}
{{/* Extract product and version from URL path for download buttons */}}
{{/* Example: /influxdb3/clustered/api/ → ["", "influxdb3", "clustered", "api", ""] */}}
{{ $pathParts := split .RelPermalink "/" }}
{{ $version := "" }}
{{ if ge (len $pathParts) 3 }}
{{ $version = index $pathParts 2 }}
{{ end }}
{{/* Section pages without staticFilePath should render content
directly, not use RapiDoc */}} {{ if and .IsSection (not .Params.staticFilePath)
}} {{ 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>
{{/* 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 }}
{{/* SECTION INDEX - Show page content then children listing */}} {{
with .Content }}
<section class="api-section-content">{{ . }}</section>
{{ end }} {{/* Always show tag pages from article data */}} {{ partial
"api/section-children.html" . }} {{ 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 }} {{/* Pages with staticFilePath
(operation pages) use RapiDoc renderer */}} {{ partial "header.html" . }} {{
partial "topnav.html" . }}
<div class="page-wrapper">
{{ partial "sidebar.html" . }}
<div class="content-wrapper">
<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>
{{/* Render API documentation using the configured renderer */}} {{
partial "api/renderer.html" . }}
</article>
<div class="copyright">&copy; {{ now.Year }} InfluxData, Inc.</div>
</div>
</div>
{{ partial "footer.html" . }} {{ end }}
<style>
/* 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>