Star
1.1K

Install Nuxt Sitemap

Get started with Nuxt Sitemap by installing the dependency to your project.
Nuxt SEO Pro
  • Nuxt Redirects
  • Nuxt Google Search Console
  • Nuxt Internal Links
  • Nuxt SEO Analyze
Save $170 on the presale now.

Setup Module

Want to know why you might need this module? Check out the introduction.

To get started with Nuxt Sitemap, you need to install the dependency and add it to your Nuxt config.

bash
npx nuxi module add @nuxtjs/sitemap

Verifying Installation

After you've set up the module with the minimal config, you should be able to visit /sitemap.xml to see the generated sitemap.

You may notice that the URLs point to your localhost domain, this is to make navigating your local site easier, and will be updated when you deploy your site.

All pages preset are discovered from your Application Sources, for dynamic URLs see Dynamic URLs.

You can debug this further in Nuxt DevTools under the Sitemap tab.

Configuration

At a minimum the module requires a Site URL to be set, this is to only your canonical domain is being used for the sitemap. A site name can also be provided to customize the sitemap stylesheet.

Site Config Quick Setup
export default defineNuxtConfig( site: {  url: 'https://example.com',  name: 'My Awesome Website'  }, }) 
For more advanced configurations, check out the site config guide .

To ensure search engines find your sitemap, you will need to add it to your robots.txt. It's recommended to use the Nuxt Robots module for this.

Robots v4.1.10
734K
421
Tame the robots crawling and indexing your site with ease.

Every site is different and will require their own further unique configuration, to give you a head start:

  • Dynamic URL Endpoint - If you have dynamic URLs you need to add to the sitemap, you can use a runtime API endpoint. For example, if your generating your site from a CMS.
  • Multi Sitemaps - If you have 10k+ pages, you may want to split your sitemap into multiple files so that search engines can process them more efficiently.

You do not need to worry about any further configuration in most cases, check the best practices guide for more information.

Next Steps

You've successfully installed Nuxt Sitemap and configured it for your project.

Documentation is provided for module integrations, check them out if you're using them.

Once you're ready to go live, check out the Submitting Your Sitemap guide.

Did this page help you?