{% extends "base.html" %} {# Author Single Page Template Displays an individual author's profile with bio, stats, and all their posts. Uses query indexes for O(1) author lookups. URL Pattern: /authors/lbliii/ Required page metadata: - author_name: "lbliii" (the author key to look up) Optional metadata: - avatar: "/images/jane.jpg" - bio: "Author bio text" - social: {twitter: "@jane", github: "janesmith"} - section_filter: "blog" (only show posts from specific section) Can also pull from data/authors.yaml: {% set author_data = site.data.authors[page.metadata.author_name] %} Context variables: - page: Current author page - page.metadata.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/content-components.html' import tag_list %} {% set author_key = page.metadata.author_name | default(page.title) %} {# Try to get author data from registry first, fall back to page metadata #} {% set author_data = site.data.authors[author_key] if site.data.authors and author_key in site.data.authors else {} %} {% set author_name = author_data.name | default(page.title) %} {% set author_bio = author_data.bio | default(page.metadata.get('bio', '')) %} {% set author_avatar = author_data.avatar | default(page.metadata.get('avatar')) %} {% set author_social = author_data.social | default(page.metadata.get('social', {})) %} {# Merge social links from data file format #} {% if author_data.github and not author_social.github %} {% set author_social = author_social | merge({'github': author_data.github}) %} {% endif %} {% if author_data.links %} {% for link in author_data.links %} {% set link_url = link.get('href') or link.get('url') or '' %} {% if 'github' in link_url %} {% set author_social = author_social | merge({'github': link_url | replace('https://github.com/', '')}) %} {% endif %} {% endfor %} {% endif %} {% set section_filter = page.metadata.get('section_filter') %} {% block content %} {{ breadcrumbs(page) }}
{% if author_avatar %} {{ author_name }} {% else %}
{{ author_name[0] | upper }}
{% endif %}

{{ author_name }}

{% if author_data.company or author_data.location %}

{% if author_data.company %}{{ author_data.company }}{% endif %} {% if author_data.company and author_data.location %} ยท {% endif %} {% if author_data.location %}{{ author_data.location }}{% endif %}

{% endif %} {% if author_bio %}

{{ author_bio }}

{% endif %} {# Social links #} {% if author_social or author_data.github %}
{% if author_social.twitter %} {% endif %} {% if author_social.github or author_data.github %} {% endif %} {% if author_social.linkedin %} {% endif %} {% if author_social.website %} {% endif %} {% if author_social.email %} {% endif %}
{% endif %}
{# O(1) lookup of all posts by this author #} {% set author_posts = site.indexes.author.get(author_key) | resolve_pages %} {# Filter by section if specified #} {% if section_filter %} {% set author_posts = author_posts | selectattr('_section.name', 'equalto', section_filter) | list %} {% endif %} {% if author_posts %} {# Statistics Section #}

Author Statistics

{{ author_posts | length }} Post{{ 's' if author_posts | length != 1 }}
{{ author_posts | map(attribute='content') | join('') | wordcount | format_number }} Words
{% set all_tags = author_posts | map(attribute='tags') | flatten | unique | list %}
{{ all_tags | length }} Topic{{ 's' if all_tags | length != 1 }}
{% set years = author_posts | map(attribute='date.year') | select('defined') | unique | sort %} {% if years %}
{{ years | first }} Member Since
{% endif %}
{# Main content from markdown #} {% if content %}
{{ content | safe }}
{% endif %} {# Posts Section #}

Posts by {{ author_name }}

{# Group toggle: All / By Year / By Category #}
{% if all_tags %} {% endif %}
{# All Posts View (default) #}
{% for post in author_posts | sort_by('date', reverse=true) %}

{{ post.title }}

{% if post.metadata.get('description') %}

{{ post.metadata.get('description') }}

{% endif %} {% if post.tags %} {% endif %}
{% endfor %}
{# By Year View #} {# By Topic View #} {% if all_tags %} {% endif %}
{% else %} {# Empty State #}

No posts found by {{ author_name }}.

{% endif %}
{% endblock %}