Prompts-GPT

next-sitemap Setup - Next.js

Created by Prompts-GPT

Set up next-sitemap in a Next.js project to automatically generate sitemap files for SEO purposes. Requirements: Initialize next-sitemap using npx next-sitemap. Set a placeholder siteUrl (e.g., https://example.com) in the config. Exclude specific dynamic or private routes using exclude (e.g., paths like /admin/* or /private/*). Configure the sitemap output to go into the public/ directory. Add a script in package.json called sitemap that runs the sitemap generation. Finally, run the generation command: npm run sitemap

Category: development
Tags: