Sitecore Community GraphQL Cookbook

Welcome to Sitecore Community GraphQL Query Cookbook

Created by the community to the community

This website serves as a centralized resource for Sitecore developers seeking GraphQL query samples tailored for XM Cloud and Experience Edge. We gather queries from both official Sitecore documentation and community contributions, ensuring a diverse range of solutions.

Utilizing the Sitecore Blok Design system, the site offers a user-friendly interface for effortless navigation through our curated collection of GraphQL queries. Developers are encouraged to submit their own queries, fostering a collaborative environment of knowledge sharing and support.

Explore the repository to find relevant GraphQL snippets, or contribute your own to help fellow developers enhance their Sitecore projects.

Find GraphQL Query snippets

Build site navigation

This sample query combines finding the site root with the ability to traverse item children. You can use the hasLayout argument to find only items with layout (navigable pages) and the includeTemplateIds argument to filter on a (base) data template.

Source: Sitecore

Show

Children items - Paging

GraphQL query to demonstrate how to retrieve children items with paging from Experience Edge

Show

Children items - Samples

GraphQL query to demonstrate different ways(hasLayout and includeTemplates) to retrieve children items from Experience Edge

Show

Dictionary Search

GraphQL query to retrieve dictionaries. This is being used the JSS SDK when fetching translations

Source: JSS SDK

Show

Fields - General Link

GraphQL query to demonstrate different ways to retrieve General Link field from Experience Edge

Show

Fields - Image

GraphQL query to demonstrate different ways to retrieve Image field from Experience Edge

Show

Fields - Multilist

GraphQL query to demonstrate different ways to retrieve Multilist field from Experience Edge

Show

Get App/Site Root Id

GraphQL query to retrieve the App/Site root id. This is being used the JSS SDK

Source: JSS SDK

Show

Get Error Pages

GraphQL query to retrieve the Error pages. This is being used the JSS SDK when getting the error page from Sitecore/Edge

Source: JSS SDK

Show

Get Layout Service Response

GraphQL query to retrieve the layout details for a specific path. This is being used the JSS SDK when the layout details for a specific page/path

Source: JSS SDK

Show

Get Redirects

GraphQL query to retrieve redirects in the redirects middleware

Source: JSS SDK

Show

Get Robots.txt

GraphQL query to retrieve the robots.txt's content. This is being used the JSS SDK when rendering the robots.txt output

Source: JSS SDK

Show

Page 1 of 2