From 3b97999b9dfc47d65e14c5240c5e8f7900a68ff4 Mon Sep 17 00:00:00 2001 From: Andrea Peruffo Date: Tue, 18 Nov 2025 20:31:23 +0000 Subject: [PATCH] support multiple authors in blog posts (#1) --- _includes/blog-band.html | 24 +++++++++-- _includes/recent-posts-band.html | 65 ++++++++++++++++++++--------- _layouts/author.html | 70 +++++++++++++++++++++++--------- _layouts/post.html | 27 +++++++++--- _layouts/tag-archive.html | 49 +++++++++++++++++----- 5 files changed, 176 insertions(+), 59 deletions(-) diff --git a/_includes/blog-band.html b/_includes/blog-band.html index a6d409ff996..a3b534a16ca 100644 --- a/_includes/blog-band.html +++ b/_includes/blog-band.html @@ -16,10 +16,26 @@
- {% if author.emailhash %} - - {% endif %} - + {% assign authors_raw = post.author | default: "" | split: "," %} + {% assign authors_clean = "" | split: "" %} + + {% for a in authors_raw %} + {% assign a_trimmed = a | strip %} + {% if a_trimmed != "" %} + {% assign authors_clean = authors_clean | push: a_trimmed %} + {% endif %} + {% endfor %} + +
{% if post.synopsis %} diff --git a/_includes/recent-posts-band.html b/_includes/recent-posts-band.html index 3064bbcc565..413941d9b1d 100644 --- a/_includes/recent-posts-band.html +++ b/_includes/recent-posts-band.html @@ -2,27 +2,52 @@

{{site.data.recent-posts-band.texts.recent_blog_posts}}

-
- {% for post in site.posts %} - {% if forloop.index <= 3 %} -
-
-
{{ post.title }}
+
+ {% for post in site.posts %} + {% if forloop.index <= 3 %} +
+
+
{{ post.title }}
+
+ +

+ {{ post.date | date: '%B %d, %Y' }}    Tags: + {% for tag in post.tags %} + {{ tag }} + {% endfor %} +

+ + {% assign authors_raw = post.author | default: "" | split: "," %} + {% assign authors_clean = "" | split: "" %} + + {% for a in authors_raw %} + {% assign a_trimmed = a | strip %} + {% if a_trimmed != "" %} + {% assign authors_clean = authors_clean | push: a_trimmed %} + {% endif %} + {% endfor %} + + + + {% if post.synopsis %} +

{{ post.synopsis | strip_html }}

+ {% else %} +

{{ post.content | strip_html | truncate: 280 }}

+ {% endif %} + +
-

- {{ post.date | date: '%B %d, %Y' }}    Tags: {% for tag in post.tags %}{{ tag}} {% endfor %} -

- {% assign author = site.data.authors[post.author] %} - - {% if post.synopsis %} -

{{ post.synopsis | strip_html }}

- {% else %} -

{{ post.content | strip_html | truncate: 280 }}

- {% endif %} - -
{% endif %} {% endfor %}
diff --git a/_layouts/author.html b/_layouts/author.html index 9262e93cc28..7dd70f29f91 100644 --- a/_layouts/author.html +++ b/_layouts/author.html @@ -6,12 +6,8 @@ {% assign author_username = page.pagination.author %} -{% assign author = page.pagination.author_data %} -{% assign page_title = 'Posts by ' | append: author.name %} - +{% assign author_data = page.pagination.author_data %} +{% assign page_title = 'Posts by ' | append: author_data.name %} {% include title-band.html page_title=page_title %} @@ -24,33 +20,60 @@
-

- {{ author.bio }} -

+

{{ author_data.bio }}

{% if paginator.posts.size > 0 %}

Posts

{% for post in paginator.posts %} - {% assign author = site.data.authors[post.author] %} + + {% comment %} Build multi-author list for this post {% endcomment %} + {% assign authors_raw = post.author | default: "" | split: "," %} + {% assign authors_clean = "" | split: "" %} + {% for a in authors_raw %} + {% assign a_trimmed = a | strip %} + {% if a_trimmed != "" %} + {% assign authors_clean = authors_clean | push: a_trimmed %} + {% endif %} + {% endfor %} +
- {{ post.title }} + {{ post.title }}
+ + +
{% if post.synopsis %}

{{ post.synopsis | strip_html }}

@@ -58,10 +81,17 @@

Posts

{{ post.content | strip_html | truncatewords: 75 }}

{% endif %}
- - + + +
+ {% endfor %} + {% if paginator.total_pages > 1 %}
{% if paginator.next_page %} @@ -71,8 +101,8 @@

Posts

Newer Posts {% endif %}
- {% endif %} - {% endif %} + {% endif %} + + {% endif %}
- diff --git a/_layouts/post.html b/_layouts/post.html index 9c98607730a..59cc797c39b 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -21,11 +21,28 @@

{{ page.title }}

{{ content }} diff --git a/_layouts/tag-archive.html b/_layouts/tag-archive.html index 64d2690ffca..614ec71f3e9 100644 --- a/_layouts/tag-archive.html +++ b/_layouts/tag-archive.html @@ -12,25 +12,48 @@

Tagged posts: '{{ page.title }}'

{% for post in page.posts %} - {% assign author = site.data.authors[post.author] %}
- {{ post.title }} + {{ post.title }}
+ +
{% if post.synopsis %}

{{ post.synopsis | strip_html }}

@@ -38,8 +61,14 @@

Tagged posts: '{{ page.title }}'

{{ post.content | strip_html | truncatewords: 75 }}

{% endif %}
- - + + + +
{% endfor %}