{% extends "base.html" %} {# ================================================================================ Author Single Page Template (Kida-Native) ================================================================================ Displays an individual author's profile with bio, stats, and all their posts. 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 card component URL Pattern: /authors/lbliii/ Context variables: - page: Current author page - params.author_name: The author key to look up - site.indexes.author: Author index - site.data.authors: Author registry (if data/authors.yaml exists) ================================================================================ #} {% from 'partials/navigation-components.html' import breadcrumbs %} {% from 'partials/components/tags.html' import tag_list %} {% from 'partials/components/post-card.html' import post_card %} {# ============================================================================= MAIN TEMPLATE ============================================================================= #} {% block content %} {# Template-scoped variables - using AuthorView for normalized access #} {% let author = (page | author_view) ?? none %} {% let section_filter = params?.section_filter ?? '' %} {% let author_index = site?.indexes?.author ?? {} %} {# Get author posts with O(1) lookup #} {% let author_posts_refs = author_index.get(author?.key ?? '') ?? [] %} {% let author_posts = author_posts_refs | resolve_pages %} {# Filter by section if specified #} {% if section_filter %} {% let author_posts = author_posts |> selectattr('_section.name', 'eq', section_filter) |> list %} {% end %} {# Calculate stats #} {% let post_count = author_posts | length %} {% let all_content = author_posts |> map(attribute='content') |> join('') %} {% let total_words = all_content | wordcount if all_content else 0 %} {% let all_tags = author_posts |> map(attribute='tags') |> flatten |> unique |> list %} {% let years = author_posts |> map(attribute='date.year') |> select('defined') |> unique |> sort %} {{ breadcrumbs(page) }}
{% if author?.avatar %} {{ author?.name }} {% else %}
{{ (author?.name[0] | upper) if author?.name else '?' }}
{% end %}

{{ author?.name }}

{% if author?.company or author?.location %}

{% if author?.company %}{{ author?.company }}{% end %} {% if author?.company and author?.location %} ยท {% end %} {% if author?.location %}{{ author?.location }}{% end %}

{% end %} {% if author?.bio %}

{{ author?.bio }}

{% end %} {# Social links - using AuthorView normalized properties #} {% if author?.twitter or author?.github or author?.linkedin or author?.website or author?.email %}
{% if author?.twitter %} {% end %} {% if author?.github %} {% end %} {% if author?.linkedin %} {% end %} {% if author?.website %} {% end %} {% if author?.email %} {% end %}
{% end %}
{% if post_count > 0 %} {# Statistics Section #}

Author Statistics

{{ post_count }} Post{{ 's' if post_count != 1 else '' }}
{{ total_words | format_number }} Words
{{ all_tags | length }} Topic{{ 's' if all_tags | length != 1 else '' }}
{% if years | length > 0 %}
{{ years | first }} Member Since
{% end %}
{# Main content from markdown #} {% if content %}
{{ content | safe }}
{% end %} {# Posts Section #}

Posts by {{ author?.name }}

{# Group toggle #}
{% if all_tags | length > 0 %} {% end %}
{# All Posts View (default) #}
{% for post in author_posts | sort(attribute='date', reverse=true) %} {{ post_card(post, variant='compact') }} {% end %}
{# By Year View #} {# By Topic View #} {% if all_tags | length > 0 %} {% end %}
{% else %} {# Empty State #}

No posts found by {{ author?.name }}.

{% end %}
{% end %}