summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2026-01-12 20:26:13 +0100
committerDawid Rycerz <dawid@rycerz.xyz>2026-01-12 20:26:13 +0100
commit4171c2204fb43f5d7483b8e42432519b69bdef1f (patch)
treeb40ea138458880aa09c791eb2717f4f5daba700e
parent6574383b53da66473013512762761862d26e686e (diff)
Add author to rss
-rw-r--r--src/content.config.ts8
-rw-r--r--src/loaders/pleroma.ts9
-rw-r--r--src/pages/micro/rss.xml.ts8
3 files changed, 25 insertions, 0 deletions
diff --git a/src/content.config.ts b/src/content.config.ts
index 032011e..5e15713 100644
--- a/src/content.config.ts
+++ b/src/content.config.ts
@@ -48,6 +48,14 @@ const micro = defineCollection({
description: z.string().optional(),
publishDate: z.date().or(z.string().transform((val) => new Date(val))),
sourceUrl: z.string().optional(),
+ author: z
+ .object({
+ username: z.string(),
+ displayName: z.string().optional(),
+ acct: z.string(),
+ url: z.string().optional(),
+ })
+ .optional(),
attachments: z
.array(
z.object({
diff --git a/src/loaders/pleroma.ts b/src/loaders/pleroma.ts
index b2c9f81..6b5b2f5 100644
--- a/src/loaders/pleroma.ts
+++ b/src/loaders/pleroma.ts
@@ -690,6 +690,14 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader {
const title = extractTitle(cleanedContent);
+ // Extract author information from status account
+ const author = {
+ username: status.account.username,
+ displayName: status.account.display_name || undefined,
+ acct: status.account.acct,
+ url: status.account.url || undefined,
+ };
+
// Create note entry
store.set({
id: `pleroma-${postId}`,
@@ -699,6 +707,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader {
cleanedContent.substring(0, 160) + (cleanedContent.length > 160 ? "..." : ""),
publishDate: new Date(status.created_at),
sourceUrl,
+ author,
attachments,
},
body: cleanedContent,
diff --git a/src/pages/micro/rss.xml.ts b/src/pages/micro/rss.xml.ts
index 5b388b6..37d7d39 100644
--- a/src/pages/micro/rss.xml.ts
+++ b/src/pages/micro/rss.xml.ts
@@ -28,12 +28,20 @@ export const GET = async (context: APIContext) => {
fullContent += imagesHtml;
}
+ // Build author customData for RSS
+ let authorCustomData = "";
+ if (post.data.author) {
+ const authorName = post.data.author.displayName || post.data.author.username;
+ authorCustomData = `<author>${authorName}</author><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">${authorName}</dc:creator>`;
+ }
+
return {
title: post.data.title,
pubDate: post.data.publishDate,
link: `micro/${post.id}/`,
description: post.data.description,
content: fullContent,
+ customData: authorCustomData,
};
});