Migrate API reference docs to Hugo-native for improved site integration#6622
Migrate API reference docs to Hugo-native for improved site integration#6622jstirnaman wants to merge 152 commits intomasterfrom
Conversation
Code reviewFound 1 issue:
docs-v2/layouts/partials/api/rapidoc.html Lines 95 to 110 in 90044bd 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
3c7ad96 to
4fccddc
Compare
|
PR Preview
Pages included in this preview
Preview auto-deploys on push. Will be cleaned up when PR closes. |
|
Works with Core and Enterprise, currently. Deployed to staging. |
|
@claude The last commit fixed the children list in the /api/ section page template, but broke the endpoint page template. Analyze. |
✅ |
Replace legacy API documentation approach with modern Scalar-based rendering:
## Architecture Changes
- Add renderer abstraction (`layouts/partials/api/`) supporting Scalar and RapiDoc
- Create `api` layout type for API reference pages (single.html, list.html)
- Configure renderer via `site.Params.apiRenderer` (default: scalar)
## OpenAPI Processing Pipeline (TypeScript)
- `api-docs/scripts/generate-openapi-articles.ts` - Main generation script
- `api-docs/scripts/openapi-paths-to-hugo-data/` - OpenAPI to Hugo data converter
- Generates per-endpoint path fragments for AI agent access
- Creates Hugo content pages with `type: api` frontmatter
## AI Agent Accessibility
- Full specs at `/openapi/influxdb-{product}.yml` and `.json`
- Per-endpoint fragments at `/openapi/influxdb-{product}/paths/`
- `<link rel="alternate">` tags in HTML for machine discovery
## Scalar Features
- Dark/light theme support synchronized with site theme
- InfluxData brand colors
- Responsive layout
- Download link for OpenAPI spec
## Products Supported
- cloud-v2, oss-v2
- influxdb3-core, influxdb3-enterprise
- cloud-dedicated, cloud-serverless, clustered
Usage: node api-docs/scripts/dist/generate-openapi-articles.js [product]
- latest-patch.html: Replace deprecated .Store with local variable assignment. The .Store method was removed from shortcode context in newer Hugo versions. - api-endpoint.html: Add nil check for productRef lookup to prevent index errors when productKey is not in productAliases dictionary. Falls back to "influxdb" as default product reference.
- yarn build:api-docs: Generate API docs for all products - yarn build:api-docs cloud-v2: Generate for specific product - yarn build:api-docs:compile: Recompile TypeScript if modified
…. Split ui-dev subagent into hugo-, ts-, and testing-specific agents.
- Add CSS for operations list cards with method badges, paths, and summaries - Remove duplicate Overview section from list.html (was duplicating summary) - Split "Data Operations" into separate nav groups: Write data, Query data, Cache data
- Add support for tag-based article generation with operations metadata - Generate articles.yml data files with tag, menuName, and isConceptual fields - Include operations array in frontmatter for tag pages
- Rewrite single.html for operation pages with RapiDoc integration - Simplify rapidoc.html partial for tag-based rendering - Add sidebar-nav include to sidebar.html for API navigation - Add tab-panels.html and tabs.html for content organization
- Add api-nav.ts for sidebar navigation collapse/expand - Add api-scalar.ts for Scalar API renderer integration - Add api-tabs.ts for tab switching functionality - Add api-toc.ts for table of contents generation - Register components in main.js
- Add YAML article data files for all InfluxDB products - Add sidebar-nav.html partial for API navigation rendering - Rename data directory from article-data to article_data for Hugo compatibility - Remove obsolete JSON articles file
- Update hugo.yml config for API docs settings - Simplify _api-overrides.scss (removed hardcoded content styles) - Import _api-layout.scss in styles-default.scss - Update API landing pages for Core and Enterprise with redirects - Update OpenAPI spec files - Update dependencies
- Update tests for new tag-based API page structure - Add tests for operations list rendering - Add tests for sidebar navigation groups
…tion - Header summary now shows only the first sentence from description using regex extraction with fallback to first line for descriptions without sentence-ending punctuation - Added Overview section with full description after endpoints list
- Sidebar nav now shows operations with method badges and paths instead of duplicating tag names when groups are expanded - Added background color to nav group items to match sidebar - Increased max-height for expanded groups to accommodate all operations - Added styles for operation items in sidebar nav (.api-nav-operation) - Fixed summary paragraph width by setting flex-basis to 100%
# Conflicts: # .github/copilot-instructions.md # layouts/shortcodes/latest-patch.html
- Switch operation anchors from {method}-{path} to
operation/{operationId} (PascalCase), matching Redocly convention
and existing content links like #operation/PutPluginFile.
Updated in Hugo templates, all-endpoints list, and JS TOC.
- Remove nested bordered containers from API operations. Operations
separated by top-border dividers instead of card wrappers. Param
lists, schema properties, and responses no longer wrapped in
bordered boxes.
- Replace CSS custom properties (var(--article-text, ...)) with SCSS
theme variables ($article-text, $article-heading, $nav-border, etc).
The CSS vars were never defined in this theme, so all text fell back
to hardcoded dark-gray values invisible in dark mode.
- Delete entire dark mode override section — now handled automatically
by Hugo's per-theme SCSS compilation.
- Add border-bottom divider to operation endpoint line for visual
separation from the operation heading.
- Update PLAN.md to mark Task 7 as completed.
The server-rendered TOC path returned early without setting up the IntersectionObserver, so the is-active class was never applied to TOC links during scroll. Extract entry IDs from pre-rendered links and pass them to setupScrollHighlighting.
…ion design Covers 4 phases: inline curl examples from OpenAPI specs, response body schema rendering, Ask AI on code blocks, and client library integration with tabbed language samples for write/query operations. https://claude.ai/code/session_01P1FJ4g1aQmSmQAH9BCmKZr
…QO' into docs-v2-pr6622
Generate curl examples at Hugo template time from OpenAPI specs, with server URL variable resolution, $ref handling, and JSON body generation from schema properties. Add "Ask AI about this example" links using existing Kapa integration. Add client library related link to all InfluxDB 3 API tag pages. Improve visual separation between operations with distinct badge colors and response body indentation.
Position the Ask AI link in a footer bar below the code sample instead of overlaying it on the code block. Use site theme colors instead of hardcoded values.
- Move Ask AI link to header bar alongside Example request title - Use theme-aware variables for code block backgrounds and colors - Fix schema example blocks: separate header bar from code content - Normalize description font sizes to inherit page base size - Keep inline code font-size proportional with font-size: inherit - Widen API content wrapper to match regular article width (~850px) - Remove TOC border-left at compressed viewport widths (1281-1535px)
Replace the 110-line productConfigs map with auto-discovery from .config.yml files. The generation script now derives Hugo paths, menu keys, and static file names from directory structure and existing frontmatter. Key changes: - discoverProducts() scans api-docs/ for .config.yml files - Each API entry generates independently (no mergeArticleData) - New frontmatter params: specDownloadPath, articleDataKey, articleSection - Templates use frontmatter lookup instead of hardcoded URL-to-key maps - list.html download button simplified from 50 lines to 5 - Cypress tests updated for Hugo-native-only URLs


API reference uplift
Replace Redoc with Hugo-native templates for API reference documentation. Operations render as standard HTML — no shadow DOM, no client-side rendering.
Hugo-native layout
layouts/partials/api/)/influxdb3/core/api/database/)Inline curl examples
{baseurl}→ default fromspec.servers[0].variables)$refresolution for parameters, request bodies, and schemasexample→default→enum[0]→ type placeholder)text/plaincontent typesinfluxdb-url.jsautomatically personalizes placeholder hostsAsk AI integration
ask-ai-openclass +data-queryattribute)ask-ai-trigger.jsRelated links
x-influxdata-relatedfrontmatterVisual improvements
#D63031) vs 4xx errors (warm orange#E17055)2pxborder, increased padding)Build and generation
yarn build:api-docsparses OpenAPI specs into Hugo data and generates content pages--cleanflag (default) removes stale files when tags are renamed or removed--dry-runflag previews what would be deleted