fix: update sitemap date formatting
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Damillora 2024-12-17 21:59:22 +07:00
parent d271ab9c8c
commit 9e54d3cc0b

View File

@ -1,5 +1,6 @@
import { json } from '@sveltejs/kit'; import { json } from '@sveltejs/kit';
import { browseAllPost } from "$lib/content/contentApi"; import { browseAllPost } from "$lib/content/contentApi";
import dayjs from 'dayjs';
export async function GET() { export async function GET() {
@ -17,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>${_post.date_updated}</lastmod>` xml += `<lastmod>${dayjs(_post.date_updated).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>'