Skip to content

Commit

Permalink
Merge pull request #520 from iamvishnusankar/fix/sitemap-namespace
Browse files Browse the repository at this point in the history
[Fix] xml namespace
  • Loading branch information
iamvishnusankar committed Oct 31, 2022
2 parents b1a38dd + c7fac77 commit 44134cf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -30,7 +30,7 @@ describe('SitemapBuilder', () => {
// Expect the generated sitemap to match snapshot.
expect(content).toMatchInlineSnapshot(`
"<?xml version=\\"1.0\\" encoding=\\"UTF-8\\"?>
<urlset xmlns=\\"https://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:news=\\"https://www.google.com/schemas/sitemap-news/0.9\\" xmlns:xhtml=\\"https://www.w3.org/1999/xhtml\\" xmlns:mobile=\\"https://www.google.com/schemas/sitemap-mobile/1.0\\" xmlns:image=\\"https://www.google.com/schemas/sitemap-image/1.1\\" xmlns:video=\\"https://www.google.com/schemas/sitemap-video/1.1\\">
<urlset xmlns=\\"http://www.sitemaps.org/schemas/sitemap/0.9\\" xmlns:news=\\"http://www.google.com/schemas/sitemap-news/0.9\\" xmlns:xhtml=\\"http://www.w3.org/1999/xhtml\\" xmlns:mobile=\\"http://www.google.com/schemas/sitemap-mobile/1.0\\" xmlns:image=\\"http://www.google.com/schemas/sitemap-image/1.1\\" xmlns:video=\\"http://www.google.com/schemas/sitemap-video/1.1\\">
<url><loc>https://example.com</loc></url>
<url><loc>https://example.com</loc><lastmod>some-value</lastmod><xhtml:link rel=\\"alternate\\" hreflang=\\"en\\" href=\\"https://example.com/en\\"/><xhtml:link rel=\\"alternate\\" hreflang=\\"fr\\" href=\\"https://example.com/fr\\"/></url>
</urlset>"
Expand Down
2 changes: 1 addition & 1 deletion packages/next-sitemap/src/builders/sitemap-builder.ts
Expand Up @@ -11,7 +11,7 @@ export class SitemapBuilder {
* @returns
*/
withXMLTemplate(content: string): string {
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="https://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="https://www.w3.org/1999/xhtml" xmlns:mobile="https://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="https://www.google.com/schemas/sitemap-image/1.1" xmlns:video="https://www.google.com/schemas/sitemap-video/1.1">\n${content}</urlset>`
return `<?xml version="1.0" encoding="UTF-8"?>\n<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">\n${content}</urlset>`
}

/**
Expand Down

0 comments on commit 44134cf

Please sign in to comment.