{# ================================================================================ API Hub Landing Page Template (Kida-Native) ================================================================================ Premium landing page for API documentation, displaying all available API types (Python, REST, CLI) in a beautiful tile layout with a hero banner. KIDA FEATURES USED: - {% let %} for template-scoped variables - Optional chaining (?.) for null-safe access - Null coalescing (??) for smart defaults - {% def %} for reusable tile component - {% match %} for type-based rendering USAGE: Auto-selected for api-hub sections or set template: api-hub/home.html ================================================================================ #} {% extends "base.html" %} {# ============================================================================= API TILE COMPONENT ============================================================================= #} {% def api_tile(subsection) %} {% let sub_type = subsection?.params?.type ?? 'python-reference' %} {% let sub_title = subsection?.title ?? 'API' %} {% let sub_href = subsection?.href ?? '#' %} {% let sub_desc = (subsection?.params?.description ?? '') | first_sentence %} {% let sub_subsections = subsection?.subsections ?? [] %} {% let sub_pages = subsection?.pages ?? [] %} {% let child_count = (sub_subsections | length) + (sub_pages | length) %} {% let preview_limit = 4 %} {# Determine preview items #} {% let sorted_subsections = subsection?.sorted_subsections ?? [] %} {% let sorted_pages = subsection?.sorted_pages ?? [] %} {% let preview_items = sorted_subsections[:preview_limit] if sorted_subsections | length > 0 else sorted_pages[:preview_limit] %}
{# Type Badge #}
{% match sub_type %} {% case _ if 'python' in sub_type %} {{ icon("code", size=12) }} Python {% case _ if 'openapi' in sub_type %} {{ icon("globe", size=12) }} REST {% case _ if 'cli' in sub_type %} {{ icon("terminal", size=12) }} CLI {% case _ %} {{ icon("book", size=12) }} API {% end %}
{# Tile Header with Icon #}
{% match sub_type %} {% case _ if 'python' in sub_type %} {{ icon("code", size=32, css_class="icon-python") }} {% case _ if 'openapi' in sub_type %} {{ icon("globe", size=32, css_class="icon-openapi") }} {% case _ if 'cli' in sub_type %} {{ icon("terminal", size=32, css_class="icon-cli") }} {% case _ %} {{ icon("book", size=32, css_class="icon-default") }} {% end %}

{{ sub_title }}

{# Tile Content #}

{% if sub_desc %} {{ sub_desc }} {% else %} {% match sub_type %} {% case _ if 'python' in sub_type %} Browse Python packages, modules, classes, and functions. {% case _ if 'openapi' in sub_type %} Explore REST API endpoints, parameters, and response schemas. {% case _ if 'cli' in sub_type %} Command-line interface documentation with options and examples. {% case _ %} API documentation and reference material. {% end %} {% end %}

{# Preview Items #} {% if preview_items | length > 0 %}
Includes:
    {% for item in preview_items %} {% let item_title = item?.title ?? item?.name ?? 'Item' %}
  • {{ item_title }}
  • {% export last_preview_item = item %} {% end %} {% let remaining = child_count - preview_limit %} {% if remaining > 0 %}
  • +{{ remaining }} more
  • {% end %}
{% end %}
{# Tile Footer #}
{% enddef %} {# ============================================================================= MAIN TEMPLATE ============================================================================= #} {% block content %} {# Template-scoped variables #} {% let hub_section = section %} {% let hub_title = section?.title ?? page?.title ?? 'API Documentation' %} {% let hub_desc = section?.params?.description ?? params?.description ?? '' %} {% let subsections = section?.sorted_subsections ?? [] %} {# Count API types #} {% let python_count = 0 %} {% let rest_count = 0 %} {% let cli_count = 0 %} {% for sub in subsections %} {% let sub_type = sub?.params?.type ?? '' %} {% if 'python' in sub_type %}{% let python_count = python_count + 1 %}{% end %} {% if 'openapi' in sub_type %}{% let rest_count = rest_count + 1 %}{% end %} {% if 'cli' in sub_type %}{% let cli_count = cli_count + 1 %}{% end %} {% end %}
{# Hero Section #}
API Reference

{{ hub_title }}

{% if hub_desc %}

{{ hub_desc }}

{% else %}

Explore comprehensive API documentation for Python modules, REST endpoints, and CLI commands.

{% end %} {# Stats Bar #} {% if subsections | length > 0 %}
{{ subsections | length }} API{{ 's' if subsections | length != 1 else '' }}
{% if python_count > 0 %}
{{ icon("code", size=16) }} {{ python_count }} Python
{% end %} {% if rest_count > 0 %}
{{ icon("globe", size=16) }} {{ rest_count }} REST
{% end %} {% if cli_count > 0 %}
{{ icon("terminal", size=16) }} {{ cli_count }} CLI
{% end %}
{% end %}
{# Custom Content from _index.md #} {% if content and content.strip() %}
{{ content | safe }}
{% end %} {# API Tiles Grid #} {% if subsections | length > 0 %}
{% for subsection in subsections %} {{ api_tile(subsection) }} {% end %}
{% else %} {# Empty State #}
{{ icon('book-open', size=64) }}

No API Documentation Yet

Enable Python, OpenAPI, or CLI autodoc in your autodoc.yaml configuration to generate API documentation.

{% end %}
{% end %}