109 lines
3.4 KiB
HTML
109 lines
3.4 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 operations list and description
|
|
|
|
For conceptual pages (isConceptual: true), shows content without operations list.
|
|
*/}}
|
|
|
|
{{ 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>
|
|
|
|
{{/* Check if this is a section index (no tag param) or a tag page */}}
|
|
{{ $hasTag := isset .Params "tag" }}
|
|
|
|
{{ if not $hasTag }}
|
|
{{/* 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 */}}
|
|
{{ $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 := .Params.operations }}
|
|
{{ if $operations }}
|
|
<section class="api-operations-list">
|
|
<h2 id="endpoints">Endpoints</h2>
|
|
<div class="api-operations-grid">
|
|
{{ range $operations }}
|
|
{{ $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 }}
|
|
|
|
{{ end }}
|
|
{{ 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" . }}
|