GraphQL requests using the items() field
This section contains a number of sample items() calls to demonstrate how to query content from SDL Tridion Sites, SDL Tridion Docs or both.
- GraphQL request for getting all Components of a certain content type
If your authors give each Component a value for a custom metadata key you created calledcontentType, you can use a GraphQL request to filter by content type. This lets you create, say, a dynamic webpage showing all content of that type. - GraphQL request for getting all pages tagged with a specific Taxonomy Keyword
This sample imagines that you have created a Category called "City" and have created a Taxonomy of Keywords in this Category, representing various cities. - GraphQL request for getting all items across SDL Tridion Sites and SDL Tridion Docs that share the same Keyword
The mashup feature lets you tag SDL Tridion Docs content with the same Keyword specified in a Taxonomy in SDL Tridion Sites, and used to tag SDL Tridion Sites content. - GraphQL request for fetching results in batches (paginated)
You can set a maximum number of results to return for your query, and if you request thecursorproperty back, you can use the cursor to fetch another batch of results, starting from where you left off last time. - GraphQL request for fetching SDL Tridion Docs topics tagged with Keywords from a SDL Tridion Docs Taxonomy
To execute a mashup scenario, fetch SDL Tridion Docs content that has the Taxonomy Keyword as some SDL Tridion Docs content, then combine the two on a webpage. - GraphQL request for getting Publications containing topics tagged with a specific Keyword
To find out which Publication or Publications contain the content that is tagged with a specific Keyword, execute a specificitems()query. This type of query can be useful in, say, a mashup scenario, where you want to identify the context in which your "mashable" content resides.