Overview:
This article discusses the process of generating a sitemap for a Nuxt3 app. It explains that the official Nuxt sitemap module does not support Nuxt3, and provides a simple way to add a sitemap to a Nuxt3 app. The article also provides setup instructions for both a static site and a dynamic site powered by @nuxt/content with prerendering.
Features:
- Support for Nuxt3: The article provides a solution for generating a sitemap for a Nuxt3 app, as the official Nuxt sitemap module does not support Nuxt3.
- Simple setup: The article provides step-by-step instructions on how to add a sitemap to a Nuxt3 app.
- Static site support: The article includes setup instructions for generating a sitemap for a simple static site, including installing the necessary dependencies and configuring the app.
- Dynamic site support with prerendering: The article also includes setup instructions for generating a sitemap for a dynamic site powered by @nuxt/content with prerendering.
Installation:
- Install
sitemap.tsas a dev dependency. - Create a new file in the modules folder.
- Copy and paste the content of
sitemap.tsinto the newly created file. - Add the following lines to your
nuxt.config.tsfile, replacing<YOUR_DOMAIN>with your actual domain. - Build your Nuxt app and see your sitemap file.
For a dynamic site with prerendering, follow the official instructions from @nuxt/content. To fix the issue of static URLs not being generated in the sitemap.xml, replace the sitemap.xml.ts file with the one provided in this repository.
Summary:
This article provides a solution for generating a sitemap for a Nuxt3 app, as the official Nuxt sitemap module does not support Nuxt3. It offers a simple setup process with step-by-step instructions for both static and dynamic sites. The article also acknowledges and gives credit to the original authors and contributors of the module.