Get all projects and update sitemaps for it immediatly as well
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { getAllBlogs } from "@/content/blogs/blogs";
|
||||
import { getAllProjects } from "@/content/projects/projects";
|
||||
import { getSettings } from "@/content/settings/settings";
|
||||
import type { APIRoute } from "astro";
|
||||
import minifyXML from "minify-xml";
|
||||
@@ -36,9 +37,25 @@ export const GET = (async () => {
|
||||
});
|
||||
};
|
||||
if (settings.project.enabled) {
|
||||
const projectLastModifieds = [
|
||||
settings.project.lastModified,
|
||||
settings.sitemap.lastModified,
|
||||
settings.website.lastModified
|
||||
];
|
||||
|
||||
let projects = await getAllProjects(settings);
|
||||
|
||||
projects.forEach((project) => {
|
||||
projectLastModifieds.push(project.lastModified);
|
||||
});
|
||||
|
||||
const lastModifiedProjects = projectLastModifieds.sort((a: Date, b: Date) => {
|
||||
return b.getTime() - a.getTime();
|
||||
});
|
||||
|
||||
sitemapIndex.push({
|
||||
url: "/sitemap/projects.xml",
|
||||
lastModified: new Date()
|
||||
lastModified: lastModifiedProjects[0]
|
||||
});
|
||||
};
|
||||
if (settings.photo.enabled) {
|
||||
|
||||
Reference in New Issue
Block a user