You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Each tenant can define both public and private Page and Product routes (i.e. the data is fetched at runtime), and I utilize multiple sitemaps respectively for each type of route.
Using Product routes as an example, I would like to do a check at runtime inside the defineSitemapEventHandler for the Products sitemap if each product is public or private.
If the product route should be public, I add to the sitemap.
If the product route is private, it is excluded from the sitemap.
After parsing all of the product routes, if there are zero product routes added to the array, I would like to prevent the products_sitemap.xml from being created rather than just returning an empty array.
Suggested solution
Ideally, returning an empty array (or undefined) from defineSitemapEventHandler should prevent the sitemap from being created, and in a multiple sitemap app, it should prevent this sitemap from being linked from the sitemap_index.xml
Alternative
Returning an empty array from defineSitemapEventHandler works for not indexing the routes, but you are left with an empty sitemap.
Additional context
I don't want to disable indexing for the whole site, just for individual sitemaps, e.g. the pages sitemap should exist, products sitemap should be empty/not exist if the array of routes is empty, but this cannot be determined until in the event handler at runtime.
The text was updated successfully, but these errors were encountered:
(cloned from harlan-zw/nuxt-seo#237)
Clear and concise description of the problem
Using Product routes as an example, I would like to do a check at runtime inside the
defineSitemapEventHandler
for the Products sitemap if each product is public or private.After parsing all of the product routes, if there are zero product routes added to the array, I would like to prevent the
products_sitemap.xml
from being created rather than just returning an empty array.Suggested solution
Ideally, returning an empty array (or
undefined
) fromdefineSitemapEventHandler
should prevent the sitemap from being created, and in a multiple sitemap app, it should prevent this sitemap from being linked from thesitemap_index.xml
Alternative
Returning an empty array from
defineSitemapEventHandler
works for not indexing the routes, but you are left with an empty sitemap.Additional context
I don't want to disable indexing for the whole site, just for individual sitemaps, e.g. the pages sitemap should exist, products sitemap should be empty/not exist if the array of routes is empty, but this cannot be determined until in the event handler at runtime.
The text was updated successfully, but these errors were encountered: