{# Section Hero - for section-index pages (API packages, CLI groups) Contract: - section: Section instance (REQUIRED) - page: Page instance - site: Site instance (from global context) - config: Autodoc config dict - hero_context: Optional dict with explicit flags: - is_cli: bool - True if CLI section (explicit, no URL sniffing) Data access: All via section.metadata.get() (dict access) Usage: {% include 'partials/page-hero/section.html' %} For CLI sections, set hero_context before include: {% set hero_context = {'is_cli': true} %} {% include 'partials/page-hero/section.html' %} #} {# Determine section type from explicit context, page type, or URL sniffing (fallback) #} {# Priority: 1. hero_context.is_cli, 2. page.type == 'autodoc-cli', 3. '/cli' in page.href #} {% set is_cli = false %} {% if hero_context is defined and hero_context and hero_context.is_cli is defined %} {% set is_cli = hero_context.is_cli %} {% elif page.type is defined and page.type == 'autodoc-cli' %} {% set is_cli = true %} {% elif page.href is defined and '/cli' in page.href %} {% set is_cli = true %} {% endif %} {# Include shared wrapper (opens .page-hero div) #} {% include 'partials/page-hero/_wrapper.html' %} {# No badges for sections #} {# Title - section title (with None check) #} {% if section and section.title %}

{{ section.title }}

{% elif page and page.title %}

{{ page.title }}

{% endif %} {# Description from section metadata (dict access) #} {% if section %} {% set desc = section.metadata.get('description', '') %} {% if desc %}
{{ desc | markdownify | safe }}
{% endif %} {% endif %} {# Footer: Stats from section children #} {% if section %} {% endif %}