Skip to content

layout: swagger passthrough for interactive API reference#407

Merged
tamalsaha merged 1 commit into
masterfrom
swagger-passthrough-layout
Jul 14, 2026
Merged

layout: swagger passthrough for interactive API reference#407
tamalsaha merged 1 commit into
masterfrom
swagger-passthrough-layout

Conversation

@tamalsaha

@tamalsaha tamalsaha commented Jul 14, 2026

Copy link
Copy Markdown
Member

What

Adds layouts/swagger/single.html, a one-line raw-passthrough layout:

{{- with .Resources.GetMatch "api.html" -}}{{ .Content | safeHTML }}{{- end -}}

Pages with type: swagger emit their bundled api.html resource verbatim. Because the template has no {{ define "main" }} block, Hugo skips baseof.html, so no header/footer/sidebar wraps the standalone Swagger UI.

Why

The KubeDB Platform docs ship a self-contained, per-version Swagger UI page (api.html, spec inlined) generated from the platform OpenAPI spec. A .html file dropped into content/ gets rendered as a wrapped page at the wrong URL; as a plain resource Hugo won't publish it. This layout is the mechanism that serves it byte-for-byte at /docs/platform/<version>/api/reference/.

Follows the existing layouts/<type>/single.html override pattern (e.g. layouts/products/single.html) — no theme change.

Companion

Requires the docs repo change that ships api.html into the versioned tree: appscode-cloud/docs#144. Land this first so the layout exists when docs first aggregate.

Verification

Built the full site with the real hugo-product-theme (Hugo 0.128.2): the page renders at docs/platform/v2026.7.10/api/reference/index.html, byte-identical (cmp) to source api.html, no theme chrome.

Add layouts/swagger/single.html, a raw-passthrough layout that emits the
api.html page resource verbatim (no baseof, so no theme chrome). Pages of
type: swagger under docs/platform/<version>/api/reference/ render the
self-contained Swagger UI generated from the platform OpenAPI spec.

Companion to the docs repo change that ships api.html into the versioned tree.

Signed-off-by: Tamal Saha <tamal@appscode.com>
@tamalsaha
tamalsaha merged commit 4cebd02 into master Jul 14, 2026
5 of 6 checks passed
@tamalsaha
tamalsaha deleted the swagger-passthrough-layout branch July 14, 2026 09:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant