{% extends "base.html" %} {# Author Archive Template Displays all posts/pages by a specific author with stats and bio. Uses query indexes for O(1) author lookups. URL Pattern: /authors/jane-smith/ Required page metadata: - author_name: "Jane Smith" (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) Usage: Create content/authors/jane-smith.md: --- title: "Jane Smith" author_name: "Jane Smith" avatar: "/images/jane.jpg" bio: "Senior developer and technical writer" template: author.html social: twitter: "@janesmith" github: "janesmith" email: "jane@example.com" --- Context variables: - page: Current author page - page.metadata.author_name: The author to query - site.indexes.author: Author index #} {% from 'partials/navigation-components.html' import breadcrumbs %} {% from 'partials/content-components.html' import tag_list %} {% set author_name = page.metadata.author_name | default(page.title) %} {% set section_filter = page.metadata.get('section_filter') %} {% block content %} {{ breadcrumbs(page) }}
{% if page.metadata.get('avatar') %} {{ author_name }} {% else %}
{{ author_name[0] | upper }}
{% endif %}

{{ author_name }}

{% if page.metadata.get('bio') %}

{{ page.metadata.get('bio') }}

{% endif %} {# Social links #} {% if page.metadata.get('social') %}
{% set social = page.metadata.get('social') %} {% if social.twitter %} {% endif %} {% if social.github %} {% endif %} {% if social.linkedin %} {% endif %} {% if social.website %} {% endif %} {% if social.email %} {% endif %}
{% endif %}
{# O(1) lookup of all posts by this author #} {% set author_posts = site.indexes.author.get(author_name) | 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 %}