Content rendering
Help us improve this documentation
The framework-agnostic documentation is under development. If you have suggestions for improving the content, let us know by sharing your Feedback at the bottom of this page.
A key development task with Sitecore is retrieving the content authored in the SitecoreAI Page builder and rendering it in your front-end application. Although the exact implementation details vary by framework, rendering SitecoreAI content follows the same main steps:
- Retrieve layout and content from SitecoreAI - in Sitecore, a layout defines which components appear on a page and where. When a content author builds a page in the Page builder, they are arranging components within a layout. In this step, you make a GraphQL query to retrieve JSON-formatted layout and content for a SitecoreAI page. In the JSON data, components represent the page structure, and the content is stored inside component fields.
- Map component names to code - map component names in the retrieved JSON, such as
"RichText", to code in your app, such as your own RichText component implementation. Each component implementation reads its own fields and renders them according to their field type. This ensures that your app can render the correct component in the user interface. - Render components recursively - ensure your app can display components nested inside other components.
Get started
To get started with content rendering:
- Learn about and get access to the Preview GraphQL API and the Delivery GraphQL API. These are the APIs you use to retrieve layout and content.
- Review the GraphQL schema, including the GraphQL entry points and how they relate to the various Sitecore concepts.
- Review the structure of the layout query and response.
- Review the field types, which is essential when building a component implementation.
- Complete the Render SitecoreAI content in your app walkthrough, where you programmatically query Sitecore for layout data, parse the recursive JSON in the response, and render components on your page.
If you have suggestions for improving this article, let us know!