Excluding noindex pages from next-sitemap in a custom implementation
Last updated: Jun 22, 2023
Hi all 👋 so we are using the next-sitemap, but I'd like to exclude all pages that are set to noindex. I have been told that "As discussed, this looks relatively tricky to achieve with the current implementation (next-sitemap) due to the fact that it executes after the main site build, and outside the scope where access to Sanity is available." but I'd like to verify this. It seems like a pretty obvious thing most people would want so I'm surprised this is considered a tricky thing to achieve. Any tips?
Jun 21, 2023, 8:19 AM
We made our own that runs in preBuildUtilities.js 🙂It’s a very simple loop through all document types we want included, and we exclude the hidden, can rank them according to their _search_priority_ attribute etc. In the end it’s just a