Exclude pages in sitemap

Hi friends,

I’ve been trying like crazy to get the Netlify sitemap plugin to exclude certain pages but without luck.

I have some serverside rendered pages I would like to exclude:

And a SSG page:
(Can only embed a single media file, but it’s https://www.domain.com/contact/success)

My netlify.toml file looks like this:

[[plugins]]
package = "@netlify/plugin-sitemap"

  [plugins.inputs]
  buildDir = ".next"
  exclude = [
    './.next/pages/contact/success.js',
    './.next/pages/industries/test/[slug].js',

  ]

I’ve also tried variations like:

    './build-dir/pages/contact/success.js',
    './pages/contact/success.js',

What am I doing wrong? :grimacing:

Hey @kasperenterspeed,

I’m not sure how well that plugin works with Next.js sites, especially since it’s mostly dynamically rendered. You should try to create a sitemap using Next.js itself for best results.

2 Likes

Hey @hrishikesh,

Thank you for the quick reply. Won’t bother with the plugin anymore then - will just use a Next.js solution instead :+1:

1 Like