You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds a new configuration option `namespaces` for more control over XML namespaces used in sitemap generation
6
+
7
+
Excluding unused namespaces can help create cleaner, more focused sitemaps that are faster for search engines to parse and use less bandwidth. If your site doesn't have news content, videos, or multiple languages, you can exclude those namespaces to reduce XML bloat.
8
+
9
+
The `namespaces` option allows you to configure `news`, `xhtml`, `image`, and `video` namespaces independently. All namespaces are enabled by default for backward compatibility and no change to existing projects is necessary. But now, you can choose to streamline your XML and avoid unnecessary code.
10
+
11
+
For example, to exclude the video namespace from your sitemap, set `video: false` in your configuration:
12
+
13
+
```
14
+
// astro.config.mjs
15
+
import { sitemap } from '@astrojs/sitemap';
16
+
17
+
export default {
18
+
integrations: [
19
+
sitemap({
20
+
namespaces: {
21
+
video: false,
22
+
// other namespaces remain enabled by default
23
+
}
24
+
})
25
+
]
26
+
};
27
+
```
28
+
29
+
The generated XML will not include the `xmlns:video` namespace:
0 commit comments