update sitemap
This commit is contained in:
parent
1895a37b3e
commit
7784d8eb7b
@ -96,8 +96,12 @@ export async function GET({ locals }) {
|
|||||||
const articles = await pb.collection("articles").getFullList({
|
const articles = await pb.collection("articles").getFullList({
|
||||||
sort: "-created",
|
sort: "-created",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const tutorials = await pb.collection("tutorials").getFullList({
|
||||||
|
sort: "-created",
|
||||||
|
});
|
||||||
|
|
||||||
const body = sitemap(stocks, articles, pages);
|
const body = sitemap(stocks, articles, pages, tutorials);
|
||||||
const response = new Response(body);
|
const response = new Response(body);
|
||||||
response.headers.set("Cache-Control", "max-age=0, s-maxage=3600");
|
response.headers.set("Cache-Control", "max-age=0, s-maxage=3600");
|
||||||
response.headers.set("Content-Type", "application/xml");
|
response.headers.set("Content-Type", "application/xml");
|
||||||
@ -109,6 +113,7 @@ const sitemap = (
|
|||||||
stocks,
|
stocks,
|
||||||
articles,
|
articles,
|
||||||
pages,
|
pages,
|
||||||
|
tutorials,
|
||||||
) => `<?xml version="1.0" encoding="UTF-8" ?>
|
) => `<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<urlset
|
<urlset
|
||||||
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
|
xmlns="https://www.sitemaps.org/schemas/sitemap/0.9"
|
||||||
@ -136,6 +141,15 @@ const sitemap = (
|
|||||||
`,
|
`,
|
||||||
)
|
)
|
||||||
.join("")}
|
.join("")}
|
||||||
|
${tutorials
|
||||||
|
.map(
|
||||||
|
(item) => `
|
||||||
|
<url>
|
||||||
|
<loc>${website}/learning-center/article/${convertToSlug(item?.title)}</loc>
|
||||||
|
</url>
|
||||||
|
`,
|
||||||
|
)
|
||||||
|
.join("")}
|
||||||
${stocks
|
${stocks
|
||||||
.map((ticker) => {
|
.map((ticker) => {
|
||||||
// Determine the path based on the type of the ticker
|
// Determine the path based on the type of the ticker
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user