Gatsby: [gatsby-plugin-sitemap] Multiple/Split Sitemap Files

Created on 26 Feb 2019  路  6Comments  路  Source: gatsbyjs/gatsby

Summary

When submitting sitemaps to Google Search Console, an error is thrown for sitemaps with more than 50,000 urls. It'd be great if there was an option to have multiple sitemap files generate with a 50,000 url limit per file.

This could be done with a number limit or maybe an include option (rather than just exclude)?

Basic example

Expecting sitemap-1.xml, sitemap-2.xml, etc.

  {
    resolve: `gatsby-plugin-sitemap`,
    options: {
       split: 50000,
     }
  }

or manually defined

  {
    resolve: `gatsby-plugin-sitemap`,
    options: {
       output: `/sitemap.xml`,
       exclude: ['/learn/*'],
     }
  },
  {
    resolve: `gatsby-plugin-sitemap`,
    options: {
       output: `/sitemap-learn.xml`,
       include: ['/learn/*'],
     }
  },

Motivation

For a larger website, this is a critical way to make sure all pages are crawled and indexed!

help wanted

Most helpful comment

According to this article "Google: No Technical Advantage To Splitting Up Sitemaps But Useful For Debugging" it would be nice to split the sitemap by "category" (instead of sitemapSize).

Do you guys know if it is possible to split it in this way?

All 6 comments

That would be a great feature indeed! Would you like to try to tackle it and create a PR?

@freiksenet @youmustfight It's interesting for me too 馃憖 Can I tackle it ? I'll send PR for it later.

Go for it @tomoyukikashiro! 馃槃 I can get to it tomorrow if you aren't able to later today

@youmustfight I'm still working it now 馃槄 in this branch. plz wait one moment. 馃憤

@youmustfight the PR was merged and shipped in [email protected] 馃憤

According to this article "Google: No Technical Advantage To Splitting Up Sitemaps But Useful For Debugging" it would be nice to split the sitemap by "category" (instead of sitemapSize).

Do you guys know if it is possible to split it in this way?

Was this page helpful?
0 / 5 - 0 ratings