fix: broken RSS item's link, which were set to https:/${base}. (#687)

This commit is contained in:
ikorihn 2024-01-14 02:08:21 +09:00 committed by GitHub
parent 1a8aedf5f5
commit 52e6c03730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,12 +48,11 @@ function generateSiteMap(cfg: GlobalConfiguration, idx: ContentIndex): string {
function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: number): string { function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: number): string {
const base = cfg.baseUrl ?? "" const base = cfg.baseUrl ?? ""
const root = `https://${base}`
const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<item> const createURLEntry = (slug: SimpleSlug, content: ContentDetails): string => `<item>
<title>${escapeHTML(content.title)}</title> <title>${escapeHTML(content.title)}</title>
<link>${joinSegments(root, encodeURI(slug))}</link> <link>https://${joinSegments(base, encodeURI(slug))}</link>
<guid>${joinSegments(root, encodeURI(slug))}</guid> <guid>https://${joinSegments(base, encodeURI(slug))}</guid>
<description>${content.richContent ?? content.description}</description> <description>${content.richContent ?? content.description}</description>
<pubDate>${content.date?.toUTCString()}</pubDate> <pubDate>${content.date?.toUTCString()}</pubDate>
</item>` </item>`
@ -78,7 +77,7 @@ function generateRSSFeed(cfg: GlobalConfiguration, idx: ContentIndex, limit?: nu
<rss version="2.0"> <rss version="2.0">
<channel> <channel>
<title>${escapeHTML(cfg.pageTitle)}</title> <title>${escapeHTML(cfg.pageTitle)}</title>
<link>${root}</link> <link>https://${base}</link>
<description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${escapeHTML( <description>${!!limit ? `Last ${limit} notes` : "Recent notes"} on ${escapeHTML(
cfg.pageTitle, cfg.pageTitle,
)}</description> )}</description>