I want to exclude certain URLs from the sitemap, depending on the custom field settings in their corresponding entries. I'm using SEO Matic plugin in craft4

1 Answer 1


Currently, the only facility for doing this would be to use an SEO Settings field in that field layout, and manually override the setting on a per-entry basis.

I can think of two possible solutions:

  1. I allow the "Include in Sitemap" field to have a text entry option where you can enter Twig to put your custom condition

  2. Trigger an event that a custom PHP module or plugin can listen for, and do the evaluation there in terms of whether the entry should be included in the sitemap or not

But before we go down that road, can you elaborate on what you're trying to accomplish here? Just excluding something from the sitemap alone does not prevent it from getting indexed.

More here: SEO Myths: Top 5 Sitemap Myths Demystified

  • Thanks for your overview. We utilize a custom entry type named Author, featuring a dedicated checkbox field designed to signify whether the author is associated with the period post-2021. When the checkbox is activated, it indicates that an author page need not be created and, consequently, should be excluded from the sitemap. Nonetheless, concerning blog posts, I desire the author's name to be visible without a hyperlink when the checkbox is enabled. If the checkbox is disabled, the link should direct to the author's profile, while if enabled, no link to an author page should be established. Nov 20 at 8:24
  • Yeah so if it is a public URL, whether it's in the sitemap or not, Google will eventually find it and index it, FWIW. Nov 20 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.