{"id":22489585,"url":"https://github.com/benoitdemaegdt/nuxt3-sitemap","last_synced_at":"2025-08-02T21:33:07.057Z","repository":{"id":41141291,"uuid":"471786098","full_name":"benoitdemaegdt/nuxt3-sitemap","owner":"benoitdemaegdt","description":"sitemap generation for nuxt3","archived":false,"fork":false,"pushed_at":"2022-11-06T12:48:06.000Z","size":197,"stargazers_count":40,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-03T00:06:48.129Z","etag":null,"topics":["nuxt","nuxt-module","nuxt3","seo","seotools","sitemap","sitemap-builder","sitemap-generator","sitemap-xml"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benoitdemaegdt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-19T18:54:23.000Z","updated_at":"2023-02-06T14:10:14.000Z","dependencies_parsed_at":"2023-01-21T02:47:36.590Z","dependency_job_id":null,"html_url":"https://github.com/benoitdemaegdt/nuxt3-sitemap","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitdemaegdt%2Fnuxt3-sitemap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitdemaegdt%2Fnuxt3-sitemap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitdemaegdt%2Fnuxt3-sitemap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benoitdemaegdt%2Fnuxt3-sitemap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benoitdemaegdt","download_url":"https://codeload.github.com/benoitdemaegdt/nuxt3-sitemap/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228500363,"owners_count":17930046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["nuxt","nuxt-module","nuxt3","seo","seotools","sitemap","sitemap-builder","sitemap-generator","sitemap-xml"],"created_at":"2024-12-06T17:20:12.729Z","updated_at":"2024-12-06T17:22:39.292Z","avatar_url":"https://github.com/benoitdemaegdt.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Sitemap generation for Nuxt3\nSo far the official [nuxt/sitemap](https://sitemap.nuxtjs.org/) module [does not support Nuxt3](https://github.com/nuxt-community/sitemap-module/discussions/234).\nHere is a simple way to add a sitemap to your Nuxt3 app.\n\n## Example\nAn example of a sitemap rendered with this code can be found [here](https://monpetitsommet.fr/sitemap.xml).\n\n\u003cimg width=\"964\" alt=\"Capture d’écran 2022-11-06 à 13 28 59\" src=\"https://user-images.githubusercontent.com/25749578/200170813-28c50ecb-989c-4311-9f11-49a25931cee6.png\"\u003e\n\n## Setup for a very simple static site (no dynamic page)\n\u003cdetails\u003e\n  \u003csummary\u003eSee instructions\u003c/summary\u003e\n\n1. install [sitemap.ts](sitemap.ts) as a dev dependency\n```bash\nnpm install --save-dev sitemap\n```\n\n2. create a new file in the modules folder\n```bash\nmkdir modules \u0026\u0026 touch modules/sitemap.ts\n```\n\n3. copy/paste the content of [sitemap.ts](sitemap.ts)\n\n4. add following lines in you nuxt.config.ts file\n```ts\nexport default defineNuxtConfig({\n  // some configs\n  modules: ['~/modules/sitemap'],\n  sitemap: {\n    hostname: 'https://\u003cYOUR_DOMAIN\u003e',\n  },\n  // more configs\n})\n```\nDon't forget to change \u003cYOUR_DOMAIN\u003e with your actual domain.\n\n5. build your nuxt app and see your sitemap file\n```bash\nnpm run build\n```\n```bash\nnpx nuxi preview\n```\n\nIn your browser go to `http://localhost:3000/sitemap.xml`\n\n### Example\nIf your pages folder looks like this :\n\n```\npages/\n├─ index.vue\n├─ blog/\n│  ├─ index.vue\n│  ├─ first-article.vue\n│  ├─ second-article.vue\n│  ├─ third-article.vue\n```\n\nThe generated sitemap will look like this :\n![Screenshot](screenshot.png)\n\u003c/details\u003e\n\n  ## Setup for a dynamic site powered by [@nuxt/content](https://content.nuxtjs.org/) with [prerendering](https://v3.nuxtjs.org/guide/deploy/static-hosting#prerendering)\n  \n\u003cdetails\u003e\n  \u003csummary\u003eSee instructions (new recommanded way)\u003c/summary\u003e\n  \n1. Follow [official instructions](https://content.nuxtjs.org/guide/recipes/sitemap) from @nuxt/content.\n\n2. These instructions are not perfect because static urls are not generated in the newly created sitemap.xml. To fix this, replace the sitemap.xml.ts file by the [sitemap.xml.ts](sitemap.xml.ts) from this repository.\n  \nYour sitemap.xml should now be available and accurate 🎉\n  \n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eSee instructions (outdated)\u003c/summary\u003e\n\n  1. install [sitemap.ts](sitemap.ts) as a dev dependency\n```bash\nnpm install --save-dev sitemap\n```\n\n2. create a new file in the modules folder\n```bash\nmkdir modules \u0026\u0026 touch modules/sitemap.ts\n```\n\n3. copy/paste the content of [sitemap-dynamic.ts](sitemap-dynamic.ts) inside your newly created `modules/sitemap.ts` file.\n\n4. add following lines in you nuxt.config.ts file\n```ts\nexport default defineNuxtConfig({\n  // some configs\n  modules: ['~/modules/sitemap'],\n  sitemap: {\n    hostname: 'https://\u003cYOUR_DOMAIN\u003e',\n  },\n  // more configs\n})\n```\nDon't forget to change \u003cYOUR_DOMAIN\u003e with your actual domain.\n\n5. build your nuxt app and see your sitemap file\n```bash\nnpm run generate\n```\n\nYour sitemap is now available in `.output/public/sitemap.xml`\n\u003c/details\u003e\n\n\n## Credits\nBig thanks to\n- [Florian Lefebvre](https://github.com/florian-lefebvre) who wrote the original code of this module. See [original Github Discussion](https://github.com/nuxt/framework/discussions/3582) and [original file](https://github.com/florian-lefebvre/portfolio/blob/c513428dea912a19ffb684b8b571b08b8882158c/modules/sitemap.ts).\n- [Diizzayy](https://github.com/Diizzayy) who fixed this module. See [this Github Discussion](https://github.com/nuxt/framework/discussions/4568).\n- [codeflorist](https://github.com/codeflorist) who found a way to generate sitemaps for prerendered sites.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitdemaegdt%2Fnuxt3-sitemap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenoitdemaegdt%2Fnuxt3-sitemap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenoitdemaegdt%2Fnuxt3-sitemap/lists"}