diff --git a/app/rss.xml/route.ts b/app/rss.xml/route.ts index 146acce..250a852 100644 --- a/app/rss.xml/route.ts +++ b/app/rss.xml/route.ts @@ -1,6 +1,8 @@ import { appFolders, baseUrl } from 'app/config' import { getPostFiles } from 'app/utils/utils' +export const dynamic = 'force-static' + export async function GET() { let list = getPostFiles(appFolders) @@ -12,8 +14,8 @@ export async function GET() { return 1 }) .map( - (post) => - ` + (post) => ` + ${post.metadata.title} ${baseUrl}/${post.folder}/${post.slug} ${post.metadata.summary || ''} @@ -25,16 +27,16 @@ export async function GET() { const rssFeed = ` - Qwas Portfolio - ${baseUrl} - This is Qwas portfolio RSS feed - ${itemsXml} + Qwas Portfolio + ${baseUrl} + This is Qwas portfolio RSS feed + ${itemsXml} ` return new Response(rssFeed, { headers: { - 'Content-Type': 'application/rss+xml', + 'Content-Type': 'application/rss+xml;charset=UTF-8', }, }) } diff --git a/app/utils/commitTime.ts b/app/utils/commitTime.ts index 48e7ce0..47953df 100644 --- a/app/utils/commitTime.ts +++ b/app/utils/commitTime.ts @@ -17,7 +17,9 @@ export function lastUpdatedCommitTime(file: string): string { { cwd: dirname(file) } ) - const output = child.stdout.toString() + const output = child.stdout + ? child.stdout.toString().trim().split(String.fromCharCode(10)) + : '' updatedCache.set(file, output) return output @@ -36,7 +38,9 @@ export function createdCommitTime(file: string): string { { cwd: dirname(file) } ) - const output = child.stdout.toString().trim().split(String.fromCharCode(10)) + const output = child.stdout + ? child.stdout.toString().trim().split(String.fromCharCode(10)) + : [] const firstCommitTime = output[output.length - 1] || '' createdCache.set(file, firstCommitTime)