Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added more pages #4

Merged
merged 5 commits into from
Jun 16, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: 🐛 sitemap type fix
  • Loading branch information
joshistoast committed Jun 16, 2023
commit ad8530e2faeb7ec6976450f94ce7fa9f0e39f14d
21 changes: 14 additions & 7 deletions src/routes/sitemap.xml/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,20 @@ export const GET = (async ({ locals, request }) => {
}

const renderUrlTag = (
url: string,
lastMod?: string,
changeFreq?: string,
image?: {
{
url,
lastMod,
changeFreq,
image,
}: {
url: string
title?: string
caption?: string
lastMod?: string
changeFreq?: string
image?: {
url: string
title?: string
caption?: string
}
}
) => {
return `
Expand Down Expand Up @@ -149,7 +156,7 @@ export const GET = (async ({ locals, request }) => {
xmlns="http:https://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http:https://www.google.com/schemas/sitemap-image/1.1"
>
${urlsDatas.map((url) => renderUrlTag(url.url, url.lastMod, url.changeFreq, url.image)).join('')}
${urlsDatas.map((data) => renderUrlTag(data)).join('')}
</urlset>
`
}
Expand Down