From 1d36c51b6bb1af53495fab46bfa3943bc7806120 Mon Sep 17 00:00:00 2001 From: HowieHz Date: Sun, 8 Mar 2026 15:47:05 +0800 Subject: [PATCH 1/2] fix: Use dc:creator for authors without email --- src/rss2.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rss2.ts b/src/rss2.ts index 513c51c..e85ae9a 100644 --- a/src/rss2.ts +++ b/src/rss2.ts @@ -175,7 +175,8 @@ export default (ins: Feed) => { if (author.email && author.name) { item.author.push({ _text: author.email + " (" + author.name + ")" }); } else if (author.name) { - item.author.push({ _text: author.name }); + needsContentNamespace = true; + item["dc:creator"] = { _text: author.name }; } }); } From bacb99988067e5e5d9d204b15fc76d220e9a874c Mon Sep 17 00:00:00 2001 From: HowieHz Date: Sun, 8 Mar 2026 15:50:55 +0800 Subject: [PATCH 2/2] refactor: Separate Dublin Core namespace handling --- src/rss2.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/rss2.ts b/src/rss2.ts index e85ae9a..71793d7 100644 --- a/src/rss2.ts +++ b/src/rss2.ts @@ -11,6 +11,7 @@ export default (ins: Feed) => { const { options, extensions } = ins; let needsAtomNamespace = false; let needsContentNamespace = false; + let needsDublinCoreNamespace = false; const base: any = { _declaration: { _attributes: { version: "1.0", encoding: "utf-8" } }, @@ -230,10 +231,13 @@ export default (ins: Feed) => { }); if (needsContentNamespace) { - base.rss._attributes["xmlns:dc"] = "http://purl.org/dc/elements/1.1/"; base.rss._attributes["xmlns:content"] = "http://purl.org/rss/1.0/modules/content/"; } + if (needsDublinCoreNamespace) { + base.rss._attributes["xmlns:dc"] = "http://purl.org/dc/elements/1.1/"; + } + // rss2() support `extensions` if (extensions) extensions.forEach((e: Extension) => {