From b824be0400ba59c91f699aa555eec7c146238fd0 Mon Sep 17 00:00:00 2001
From: Ibraheem Ahmed
Date: Wed, 11 Sep 2024 17:10:59 -0400
Subject: [PATCH 1/3] allow multiple authors and update previous content
---
src/components/HtmlHead/index.astro | 16 ++++++++++------
src/components/PostHeader/index.astro | 14 ++++++++++++--
src/content/blog/2023/06/tldr-1.md | 3 ++-
src/content/blog/2023/07/tldr-2.md | 3 ++-
src/content/blog/2023/07/tldr-3.md | 3 ++-
src/content/blog/2023/08/tldr-4.md | 3 ++-
src/content/blog/2023/08/tldr-5.md | 3 ++-
src/content/blog/2023/09/tldr-6.md | 3 ++-
src/content/blog/2023/09/tldr-7.md | 3 ++-
src/content/blog/2023/10/tldr-8.md | 3 ++-
src/content/blog/2023/10/tldr-9.md | 3 ++-
src/content/blog/2023/11/tldr-10.md | 3 ++-
src/content/blog/2023/11/tldr-11.md | 3 ++-
src/content/blog/2023/11/tldr-12.md | 3 ++-
src/content/blog/2023/12/tldr-13.md | 3 ++-
src/content/blog/2024/09/new-blog.md | 3 ++-
src/content/docs/writing-posts.md | 6 ++++--
src/layouts/Base/index.astro | 6 +++---
src/layouts/BlogPost/index.astro | 13 +++++++++----
src/layouts/BlogPost/styles.css | 5 +++++
src/pages/[year]/[month]/[slug].astro | 4 ++--
src/schemas/blog.ts | 2 +-
src/utils/post.ts | 15 +++++++++++++++
23 files changed, 89 insertions(+), 34 deletions(-)
diff --git a/src/components/HtmlHead/index.astro b/src/components/HtmlHead/index.astro
index 4b60335..99b1960 100644
--- a/src/components/HtmlHead/index.astro
+++ b/src/components/HtmlHead/index.astro
@@ -10,7 +10,7 @@ interface Props {
url: string,
description: string,
tags?: string[],
- author?: string,
+ authors?: string[],
image?: string,
imageAlt?: string,
createdAt?: Date,
@@ -21,7 +21,7 @@ interface Props {
const {
htmlTitle, title, url,
description, tags,
- author,
+ authors,
image, imageAlt,
@@ -71,12 +71,16 @@ const socialImage = `${BLOG_URL}${(image ?? defaultSocialImage.src).replace(/^\/
- {author && (
-
-
-
+ {authors && (
+
+
)}
+ {authors?.map((author) => (
+
+
+ ))}
+
diff --git a/src/components/PostHeader/index.astro b/src/components/PostHeader/index.astro
index a8c35ee..e2018ed 100644
--- a/src/components/PostHeader/index.astro
+++ b/src/components/PostHeader/index.astro
@@ -2,6 +2,7 @@
import { Image } from 'astro:assets';
import { Icon } from 'astro-icon/components';
+import { getFormattedAuthorsList } from '../../utils/post';
import SiteNav from '../SiteNav/index.astro';
import './styles.css';
@@ -17,7 +18,8 @@ interface Props {
imageAlt?: string,
readingTime?: number,
wordCount?: number,
- letterCount?: number
+ letterCount?: number,
+ authors: string[]
}
const {
@@ -26,7 +28,8 @@ const {
createdAt, updatedAt,
hasUpdates,
image, imageAlt,
- readingTime, wordCount
+ readingTime, wordCount,
+ authors
} = Astro.props;
const formatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long', timeStyle: 'long' });
@@ -84,6 +87,13 @@ const formatter = new Intl.DateTimeFormat('en-US', { dateStyle: 'long', timeStyl
)}
+ {authors && (
+
+
+ By {getFormattedAuthorsList(authors)}
+
+
+ )}