What is @docusaurus/plugin-sitemap?
@docusaurus/plugin-sitemap is a plugin for Docusaurus, a popular static site generator. This plugin helps in generating a sitemap for your Docusaurus site, which is essential for SEO as it helps search engines to crawl and index your site more effectively.
What are @docusaurus/plugin-sitemap's main functionalities?
Generate Sitemap
This feature allows you to generate a sitemap for your Docusaurus site. You can configure the change frequency and priority for the URLs in the sitemap.
module.exports = {
plugins: [
'@docusaurus/plugin-sitemap',
{
id: 'default',
changefreq: 'weekly',
priority: 0.5,
},
],
};
Custom Sitemap Path
This feature allows you to specify a custom path for the generated sitemap file. By default, the sitemap is saved as 'sitemap.xml', but you can change it to any filename you prefer.
module.exports = {
plugins: [
'@docusaurus/plugin-sitemap',
{
id: 'default',
changefreq: 'weekly',
priority: 0.5,
sitemapFilename: 'custom-sitemap.xml',
},
],
};
Exclude Specific URLs
This feature allows you to exclude specific URLs or patterns from the sitemap. This is useful if you have pages that you do not want to be indexed by search engines.
module.exports = {
plugins: [
'@docusaurus/plugin-sitemap',
{
id: 'default',
changefreq: 'weekly',
priority: 0.5,
exclude: ['/exclude-this-page', '/exclude-this-directory/*'],
},
],
};
Other packages similar to @docusaurus/plugin-sitemap
sitemap
The 'sitemap' package is a general-purpose sitemap generator for Node.js. It offers more flexibility and can be used with any static site generator or web framework. Unlike @docusaurus/plugin-sitemap, it is not specifically tailored for Docusaurus and requires more manual setup.
next-sitemap
The 'next-sitemap' package is designed specifically for Next.js applications. It provides similar functionalities like generating sitemaps, setting change frequencies, and excluding specific URLs. However, it is tailored for Next.js and not for Docusaurus.
gatsby-plugin-sitemap
The 'gatsby-plugin-sitemap' package is a plugin for Gatsby, another popular static site generator. It offers similar functionalities such as generating sitemaps and excluding specific URLs. It is specifically designed for Gatsby and not for Docusaurus.