diff --git a/src/lib/content/contentApi.ts b/src/lib/content/contentApi.ts index ab2e137..5dc06b7 100644 --- a/src/lib/content/contentApi.ts +++ b/src/lib/content/contentApi.ts @@ -18,7 +18,8 @@ const indexPageFields = [ "author.profile_image.*", ]; const allPageFields = [ - ...indexPageFields + ...indexPageFields, + "date_created" ]; const postPageFields = [...indexPageFields, "status", "content"]; const authorPageFields = [ diff --git a/src/lib/content/directusUtils.ts b/src/lib/content/directusUtils.ts index a7221f6..e93f09b 100644 --- a/src/lib/content/directusUtils.ts +++ b/src/lib/content/directusUtils.ts @@ -77,6 +77,7 @@ export const mapSitemapPosts = (post: any) => { excerpt: post.excerpt, date_published: post.date_published, date_updated: post.date_updated, + last_modified: post.date_updated ?? post.date_created, reading_time: null, url: generatePostUrl(category?.slug, post.slug), } diff --git a/src/routes/sitemap.xml/+server.ts b/src/routes/sitemap.xml/+server.ts index 1a166ad..55ba689 100644 --- a/src/routes/sitemap.xml/+server.ts +++ b/src/routes/sitemap.xml/+server.ts @@ -18,7 +18,7 @@ export async function GET() { allPosts.map((_post) => { xml += '' xml += `${_post.url}` - xml += `${dayjs(_post.date_updated).format('YYYY-MM-DDTHH:mm:ss[+07:00]')}` + xml += `${dayjs(_post.last_modified).format('YYYY-MM-DDTHH:mm:ss[+07:00]')}` xml += `always` xml += `0.5` xml += ''