Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide reference to original content node when generating sitemap nodes #144

Closed
patrickdemooij9 opened this issue Dec 30, 2022 Discussed in #141 · 1 comment
Closed

Comments

@patrickdemooij9
Copy link
Owner

Discussed in #141

Originally posted by ianleeder December 29, 2022
We would like the ability to hide individual content nodes from the sitemap, not just document types. I've added a flag to my master document type.

I'm looking at the GenerateSitemapNodeNotification, but the event object doesn't provide an easy way to reference the original content node (it includes a URL, but I can't see a ContentService.GetByUrl method), so I can't read my flag.

I've tracked the event source down to the GetSelfAndChildren method in SitemapGenerator, and each sitemap node is created from a content node (IPublishedContent). Would it be feasible (particularly with respect to performance) to include the source IPublishedContent in the SitemapNodeItem? Then in my notification event I could simply write:

notification.Node.HideFromSitemap |= notification.Node.SourceContent.GetPropertyValue<bool>("hideFromSitemap");

This also seems like it would be more performant than having to do a Content lookup on each node (eg by URL or id).

Or am I going about this the wrong way?

@patrickdemooij9
Copy link
Owner Author

Fixed in latest release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant