iamvishnusankar / next-sitemap

Sitemap generator for next.js. Generate sitemap(s) and robots.txt for all static/pre-rendered/dynamic/server-side pages.
https://next-sitemap.iamvishnusankar.com
MIT License
3.27k stars 126 forks source link

[Proposal] Add `sitemapSiteUrl` Field to Facilitate Sitemap Index Generation with External Hosting #789

Closed moonrailgun closed 4 days ago

moonrailgun commented 6 months ago

Is your feature request related to a problem? Please describe.

Currently, our system generates sitemap indexes that assume the sitemap XML files are hosted within the same domain as the application. However, in cases where the main sitemap XML content is deployed on a different site, managing and linking these external sitemaps becomes cumbersome and error-prone.

For example, we have a huge sitemap(more than 100k record), we dont wanna manage it in major repo, and also dont transport it with any backend(because file is too large). so a static file which host sitemap with s3(maybe others) is a best solution.

but we also wanna keep major sitemap in main repo(domain).

Describe the solution you'd like

We need to introduce a new field named sitemapSiteUrl in our configuration. This addition is aimed at enhancing the generation and management of sitemap indexes, especially when the main sitemap XML is hosted externally.

Introduce a sitemapSiteUrl field which will allow users to specify the base URL where the main sitemap XML is hosted. This field will be used to prepend the correct site URL to the sitemap entries in the index, thus facilitating proper linking and management.

Now generate file should looks like those:

sitemap.xml:

<?xml version="1.0" encoding="UTF-8"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap><loc>https://sitemap.exmaple.com/sitemap-0.xml</loc></sitemap>
</sitemapindex>

sitemap-0.xml:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:mobile="http://www.google.com/schemas/sitemap-mobile/1.0" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">
<url><loc>https://exmaple.com/xxxxxx</loc><lastmod>2024-03-25T03:32:54.391Z</lastmod><changefreq>daily</changefreq><priority>1</priority></url>
</urlset>

Describe alternatives you've considered

Here is my patches:

image

and git ignore file:

image

Additional context

If you think its a good idea, i can create a PR for that

github-actions[bot] commented 4 months ago

Closing this issue due to inactivity.

moonrailgun commented 4 months ago

Closing this issue due to inactivity.

👎

github-actions[bot] commented 2 months ago

Closing this issue due to inactivity.

moonrailgun commented 2 months ago

Is this project no longer maintained?

github-actions[bot] commented 1 week ago

Closing this issue due to inactivity.