Skip to content

Commit f1689f3

Browse files
authored
fix(sitemap): ensure all canonical URL (#4225)
1 parent e946be8 commit f1689f3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/paste-website/src/pages/sitemap.xml.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ export const getServerSideProps: GetServerSideProps = async ({ res }) => {
1212
const sitemap = `<?xml version="1.0" encoding="UTF-8"?>
1313
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
1414
${SITEMAP.map((url) => {
15+
let fullUrl = `${BASE_URL}${url}`;
16+
17+
if (!fullUrl.endsWith("/")) {
18+
fullUrl += "/";
19+
}
20+
1521
return `
1622
<url>
17-
<loc>${BASE_URL}${url}</loc>
23+
<loc>${fullUrl}</loc>
1824
<changefreq>daily</changefreq>
1925
<priority>0.7</priority>
2026
</url>

0 commit comments

Comments
 (0)