← Back to all Resources

Sitemap management for sites with more than 50k CMS items

Sitemap
SEO
Custom code

Potential solutions

Programmatically create and update sitemaps

Node server + Webflow sitemap + Proxy

With this solution, you would need to spin up your own Node server in your infrastructure and then use a couple of packages to generate multiple sitemaps.

Use the sitemap-urls npm package to get all of your URLs from Webflow’s auto-generated sitemap. This will extract all the URLs and return them as an array that you can store. 

Then you can use the sitemap npm package and feed it that array to generate multiple sitemaps. As you’ll see at the page for the package, it does support more than 50k URLs. Here’s an example code snippet:

const sms = new SitemapAndIndexStream({
  limit: 50000, // defaults to 45k
  lastmodDateOnly: false, // print date not time
  // SitemapAndIndexStream will call this user provided function every time
  // it needs to create a new sitemap file. You merely need to return a stream
  // for it to write the sitemap urls to and the expected url where that sitemap will be hosted
  getSitemapStream: (i) => {
    const sitemapStream = new SitemapStream({
      hostname: "https://example.com",
    });
    // if your server automatically serves sitemap.xml.gz when requesting sitemap.xml leave this line be
    // otherwise you will need to add .gz here and remove it a couple lines below so that both the index
    // and the actual file have a .gz extension
    const path = `./sitemap-${i}.xml`;

    const ws = sitemapStream
      .pipe(createGzip()) // compress the output of the sitemap
      .pipe(createWriteStream(resolve(path + ".gz"))); // write it to sitemap-NUMBER.xml

    return [
      new URL(path, "https://example.com/subdir/").toString(),
      sitemapStream,
      ws,
    ];
  },
});

As you’ll see in the example above, if you set the limit to 50k, then it will default to 45k just to ensure you don’t break any limits.

Once your sitemaps are created, you can use the proxy you’re building for 301s to proxy this sitemap into place and then update Google Search Console with the new sitemap address.

Node server + Webflow APIs + Proxy

With our API v2, we  have a Pages API which would allow you to take a similar approach but instead of relying on the auto-generated sitemap, you could use the API. This would allow you to write logic to leave pages/items out of your map. 

This approach would be similar. You would use the API to get a list of static pages, as well as your CMS items and then store them in an array. The URLs would be relative, so you may need to modify them as you store them by prepending your desired URL.

Now that you have a list of pages, you can use the same npm package (sitemap) and then feed it the list of URLs and let it generate multiple sitemaps that you can then proxy into place.

Timing

Once in place, you can use cron jobs to have these run on a regular basis to keep your sitemap up to date and the process should be fairly hands off.

Related resources

Retrieving UTM Parameters and Adding Hidden Inputs to Forms

Captures UTM parameters as hidden form inputs for campaign tracking via form submissions.
Developer
Video
Custom code
Forms
Marketing

Saving and Retrieving User Input with Local Storage

How to save and retrieve user input on a form from/to local storage and show it on a thank you page.
Developer
Video
Custom code
Forms
Marketing

Managing a sitemap with a reverse proxy

Ways to create a custom sitemap when there is a reverse proxy set up in front of your Webflow site
Developer
Article
SEO
Reverse proxy
Sitemap

Using an iframe on the page

Performance and accessibility considerations when using iframes
Developer
Article
Accessibility
Performance
Custom code
Security

Splitting your Webflow site into multiple projects

Considerations when splitting or separating a single Webflow site into two projects
Designer
Article
DNS
Hosting
Migration
SEO
Security

Domain migration

Safeguard the user experience, functionality, and security of your website during a domain migation.
Developer
Article
DNS
Hosting
Migration
SEO
Security

Creating your own middleware

A guide to creating middleware to protect your API keys when making front-end calls in Webflow
Developer
Github
Custom code
API

Canonical tags

Set your site's canonical tag to tell search engines the primary or preferred domain for your site
Marketer
Article
SEO

Dialog element for modals and popups

Build more accessible pop up elements by using the dialog element with custom elements in Webflow
Developer
Nugget
Accessibility
Custom code

Custom code workflows

Methods for working with custom code in Webflow
Developer
Article
Custom code