{% extends "base.html" %} {# ================================================================================ Documentation List Template (Kida-Native) ================================================================================ Three-column layout for documentation section index pages. LAYOUT: - Left sidebar: Navigation tree - Center: Content + Content tiles (children + related) - Right sidebar: Contextual Graph + TOC + metadata KIDA FEATURES USED: - {% let %} for template-scoped variables - Optional chaining (?.) for null-safe access - Null coalescing (??) for smart defaults - Pipeline operator (|>) for filter chains - {% def %} for reusable inline functions - {% match %} for variant dispatch - {% cache %} for computed content tiles FRONTMATTER (discover: structure): discover: children: title: "Custom Title" # or false to hide variant: "cards" # compact | cards | minimal children: false # disable children entirely related: title: "Custom Title" limit: 5 related: false # disable related entirely USAGE: Set `template: doc/list.html` in frontmatter Or set `type: doc` to auto-select this template ================================================================================ #} {% from 'partials/navigation-components.html' import breadcrumbs, page_navigation, toc %} {% from 'partials/components/tags.html' import tag_list %} {% from 'partials/components/tiles.html' import content_tiles %} {# ============================================================================= HELPER FUNCTIONS ============================================================================= #} {# Parse discover config with smart defaults #} {% def parse_discover_config(discover_config, default_title, default_variant='compact', default_limit=5) %} {% match discover_config %} {% case false %} {# Explicitly disabled #} {{ {'enabled': false, 'title': none, 'variant': none, 'limit': 0} }} {% case _ if discover_config is mapping %} {# Config object provided #} {{ { 'enabled': true, 'title': discover_config.title ?? default_title if discover_config.title is not sameas false else none, 'variant': discover_config.variant ?? default_variant, 'limit': discover_config.limit ?? default_limit } }} {% case _ if discover_config is number %} {# Just a limit number #} {{ {'enabled': true, 'title': default_title, 'variant': default_variant, 'limit': discover_config} }} {% case _ %} {# Default: enabled with defaults #} {{ {'enabled': true, 'title': default_title, 'variant': default_variant, 'limit': default_limit} }} {% end %} {% end %} {# ============================================================================= MAIN TEMPLATE ============================================================================= #} {% block content %} {# Template-scoped configuration #} {% let discover = params?.discover ?? {} %} {% let children_config = parse_discover_config(discover?.children, 'In This Section', 'compact', 999) %} {% let related_config = parse_discover_config(discover?.related, 'Related Pages', 'compact', 5) %} {# Feature flag check #} {% let show_children_feature = 'content.children' in (theme?.features ?? []) %} {% let show_children = children_config.enabled and show_children_feature %} {% let show_related = related_config.enabled %} {# Content availability #} {% let has_children = (posts | length > 0) or (subsections | length > 0) %} {% let related_posts = page?.related_posts ?? [] %} {% let has_related = show_related and (related_posts | length > 0) %} {# Three-column documentation layout #}
{# Left Sidebar: Navigation #} {# Main Content #}
{# Page Hero: List pages default to 'overview' variant #} {% let _list_hero_default = 'overview' %} {% include 'partials/page-hero.html' %} {# Article Content #}
{# Main content #}
{{ content | safe }}
{# Content tiles - children and related pages #} {% if show_children and (has_children or has_related) %} {% cache "doc-list-tiles-" ~ (page?.href ?? '') ~ "-" ~ (site?.build_id ?? '') %}
{{ content_tiles( title=children_config.title if has_children else none, children=posts if show_children else none, subsections=subsections if show_children else none, related=related_posts[:related_config.limit] if has_related else none, related_title=related_config.title, variant=children_config.variant, group_by='type' if has_children and has_related else none, page=page ) }}
{% endcache %} {% end %} {# Tags #} {% if page?.tags | length > 0 %}
{{ tag_list(page.tags) }}
{% end %}
{# Page navigation (prev/next) at bottom #} {{ page_navigation(page) }}
{# Right Sidebar: Contextual Graph + TOC + Metadata #} {% if toc_items %} {% end %}
{# Mobile sidebar toggle #} {% spaceless %} {% end %} {# Sidebar overlay for mobile #} {% end %}