CAML Query to show pages with a specific Enterprise Keyword excluding Templates

Copper Contributor

Hi All,


Hoping someone can please help! 
I have created page templates where an Enterprise Keyword is part of the page properties. I want to use this value in a Highlighted content webpart so I am displaying only site pages that are related to that topic. 

However as my template pages have the value on them (to ensure my content creators don't forget to add the managed property....) the templates are showing in the results.


Can anyone please help with a custom query (CAML as I'm using the Site Pages Library) that will show when the Enterprise Keywords column contains a value AND when the SitePageFlags is not template. If there is a KQL query that shows only pages with the same filters applied then happy to try that too. 


Thanks in advance! 

0 Replies