Modifying the Sitemap for a channel programmatically

Is it possible to override the process that lists out the pages in the experience manager preview/editor? I want to conditionally render specific sitemap items based on some configurations we are adding such as if we have local experience pages within the site’s content folder, then we render the item, otherwise we hide it.

We currently have a sitemap item handler that we use to default relative content paths. I have tried to leverage that to set the isHiddenInChannelManager() function for the item, but the sitemap is loaded and displayed before ever calling the handler. And that seems to work outside of the context of the experience manager view.

I’m not quite sure I understand the usecase, but instinctively I would say this is either not possible or not worth the effort. Perhaps you could explain a bit more what you are trying to achieve?