fix: invalid sitemap dates
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Damillora 2024-12-19 22:47:41 +07:00
parent 9e54d3cc0b
commit 14db971b9a
3 changed files with 4 additions and 2 deletions

View File

@ -18,7 +18,8 @@ const indexPageFields = [
"author.profile_image.*", "author.profile_image.*",
]; ];
const allPageFields = [ const allPageFields = [
...indexPageFields ...indexPageFields,
"date_created"
]; ];
const postPageFields = [...indexPageFields, "status", "content"]; const postPageFields = [...indexPageFields, "status", "content"];
const authorPageFields = [ const authorPageFields = [

View File

@ -77,6 +77,7 @@ export const mapSitemapPosts = (post: any) => {
excerpt: post.excerpt, excerpt: post.excerpt,
date_published: post.date_published, date_published: post.date_published,
date_updated: post.date_updated, date_updated: post.date_updated,
last_modified: post.date_updated ?? post.date_created,
reading_time: null, reading_time: null,
url: generatePostUrl(category?.slug, post.slug), url: generatePostUrl(category?.slug, post.slug),
} }

View File

@ -18,7 +18,7 @@ export async function GET() {
allPosts.map((_post) => { allPosts.map((_post) => {
xml += '<url>' xml += '<url>'
xml += `<loc>${_post.url}</loc>` xml += `<loc>${_post.url}</loc>`
xml += `<lastmod>${dayjs(_post.date_updated).format('YYYY-MM-DDTHH:mm:ss[+07:00]')}</lastmod>` xml += `<lastmod>${dayjs(_post.last_modified).format('YYYY-MM-DDTHH:mm:ss[+07:00]')}</lastmod>`
xml += `<changefreq>always</changefreq>` xml += `<changefreq>always</changefreq>`
xml += `<priority>0.5</priority>` xml += `<priority>0.5</priority>`
xml += '</url>' xml += '</url>'