More Premium Hugo Themes Premium Nuxt Themes

Nuxt3 Sitemap

sitemap generation for nuxt3

Nuxt3 Sitemap

sitemap generation for nuxt3

Author Avatar Theme by benoitdemaegdt
Github Stars Github Stars: 56
Last Commit Last Commit: Nov 6, 2022 -
First Commit Created: Dec 18, 2023 -
Nuxt3 Sitemap screenshot

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:

  1. Install sitemap.ts as a dev dependency.
  2. Create a new file in the modules folder.
  3. Copy and paste the content of sitemap.ts into the newly created file.
  4. Add the following lines to your nuxt.config.ts file, replacing <YOUR_DOMAIN> with your actual domain.
  5. 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.