{% extends "base.html" %} {# ================================================================================ API Reference Section Index Template (Kida-Native) ================================================================================ Renders an API section index page showing subsections and modules using a card-based layout. Extends base.html to inherit theme navigation. TEMPLATE VARIABLES: - section: Section object for the API section (required) - page: PageContext proxy with title, metadata, _path - config: Autodoc configuration - site: Site instance KIDA FEATURES USED: - Optional chaining (?.) for safe attribute access on nullable objects - Null coalescing (??) for providing defaults - {% let %} for template-scoped computed values - {% match %} for element type icon dispatch - Pipeline-friendly filtering ================================================================================ #} {% from 'partials/navigation-components.html' import breadcrumbs, page_navigation, toc %} {% block content %} {# Template-scoped caching of computed values #} {% let section_subsections = section?.sorted_subsections ?? [] %} {% let section_pages = section?.sorted_pages ?? [] %} {# Build module pages list (non-index pages only) Use list comprehension style via filters for Kida #} {% let module_pages = section_pages | rejectattr('source_path', 'match', '.*_index.*') | reject('eq', section?.index_page) | list %} {# Three-column documentation layout #}
{# Left Sidebar: Navigation #} {# Main Content #}
{# Page Hero: Use direct macro call with explicit context #} {% from 'partials/page-hero/_macros.html' import hero_section %} {{ hero_section(section, page, {}) }} {# Article Content - autodoc skeleton #}
{# Subsections (Packages) - Card Grid #} {% if section_subsections | length > 0 %}

Packages

{% for subsection in section_subsections %} {% set subsection_name = subsection?.name ?? '' %} {% if subsection_name %} {% set desc = (subsection?.metadata?.description ?? '') | first_sentence %} {% set child_count = ((subsection?.subsections ?? []) | length) + ((subsection?.pages ?? []) | length) %}
{{ icon("folder", size=20, css_class="icon-muted") }} {{ subsection_name | title }}

{{ desc if desc else subsection_name ~ ' package' | title }}

{% end %} {% end %}
{% end %} {# Module Pages - Card Grid #} {% if module_pages | length > 0 %}

Modules

{% end %} {# Empty State #} {% if section_subsections | length == 0 and module_pages | length == 0 %}
{{ icon("file-text", size=48, css_class="icon-muted") }}

No documentation available in this section yet.

{% end %}
{# Page navigation (prev/next) at bottom - null-safe #} {% if page %} {{ page_navigation(page) }} {% end %}
{# Right Sidebar: Contextual Graph + TOC + Metadata #} {% include 'partials/docs-toc-sidebar.html' %}
{# Mobile sidebar toggle button #} {# Sidebar overlay for mobile #} {% end %}