Is there a way to get all content items with configured layout using GraphQL Content Search API?

I noticed, type children(requirePresentation: true) consists of an argument for requirePresentation to filter only items with presentation.

Can I extend GraphQL Content Search API and include this in the search schema?

  • Have you tried using fragments? Please have a look at this post: sitecore.stackexchange.com/questions/28173/…
    – Julius A
    Jul 29, 2021 at 7:27
  • 1
    Hi @JuliusA, yes I have tried fragments although when using fragments I have to explicitly drill down to all the children of children. In JSS 16+ they have already provided a hasLayout field which you can use to query field in search api. search(fieldsEqual: [{name: "hasLayout", value: "True"}])
    – Romeo
    Jul 30, 2021 at 6:55

1 Answer 1


This has been addressed in JSS 16+ where hasLayout computed field has been added to query content items with layout. You can use this query below to get this result.

  search(fieldsEqual: [{name: "hasLayout", value: "True"}]) {
    results {
      items {

If you're in JSS 15 below you need to add a computed field that checks if Layout exists and add it to your config.

public class HasLayout : IComputedIndexField
      public object ComputeFieldValue(IIndexable indexable)
          Item item = (indexable as SitecoreIndexableItem);
          return item.Visualization != null && item.Visualization.Layout != null;
      public string FieldName { get; set; }
      public string ReturnType { get; set; }

Your Answer

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

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