DEV Community

Jeroen Fürst for TrueLime

Posted on

Embracing the Headless Channel in Xperience by Kentico

In December last year, Xperience by Kentico rolled out 🎁 a significant refresh, introducing the Headless Channel functionality. This innovative feature is designed to enhance content delivery and management in the digital ecosystem. By leveraging the Headless Channel, users can now seamlessly distribute content across various platforms, including campaign websites, mobile apps, and microsites. This development marks a significant shift in how content is managed and delivered, offering greater flexibility and efficiency 💪. In this article, we'll dive into the Headless Channel and discover how it enhances digital content strategies.

Channel Management in Xperience by Kentico

In Xperience by Kentico, channels are a pivotal concept for organizing and delivering content. These channels include website channels for traditional web content, email channels for digital marketing, and the brand new headless channels for API-driven content delivery.

Each channel type serves a specific purpose: website channels focus on content for web presentations, email channels are dedicated to managing and delivering marketing communications 📣, and headless channels provide greater flexibility for content distribution across various platforms. This segmentation not only refines content management and delivery strategies but also facilitates seamless integrations ⚙️, enhancing the effectiveness of digital content across various platforms.

Advantages of the Headless Channel

The Headless Channel in Xperience by Kentico is designed to simplify content management and distribution. This functionality, which requires minimal development effort to implement, can be easily activated and configured. It enables the efficient distribution of specific content across various applications, services, and online platforms.

This approach is particularly beneficial for teams looking to enhance their digital presence without the need for extensive coding or software development. By leveraging the GraphQL API endpoint, developers can prepare and execute queries to retrieve the desired content. This makes the Headless Channel a valuable tool 🔨 for content managers and developers, offering ease of use and practicality.

The differences between REST and Headless

If you're familiar with the REST service in Kentico Xperience, the Headless functionality is a notable enhancement, offering performance benefits and greater flexibility. While the REST service facilitates the management of system objects or pages, the Headless approach, using a GraphQL API endpoint, streamlines content distribution across multiple channels. Furthermore, it provides content editors with full control 💯 over the content they wish to distribute via the headless channel. This not only improves performance but also simplifies the process of repurposing existing content for different platforms.

Secured by default

In Xperience by Kentico, the security of the Headless channel is organized through token authentication. This model enhances data protection by securing the GraphQL API endpoint, requiring valid API keys 🔑 for access and permitting only authenticated requests with authorized security tokens.

Furthermore, Xperience by Kentico's headless API enables Cross-Origin Resource Sharing (CORS), allowing for effortless integration with web applications across different domains. Configuring the CorsAllowedOrigins setting allows you to specify which domains are authorized to access the API, ensuring that responses include the necessary Access-Control-Allow-Origin header.

Configuration of Headless content

To effectively utilize the Headless Channel in Xperience by Kentico, it's essential to configure headless items. These items are key in determining what content types will be available through the GraphQL API. The approach involves identifying and setting up the specific content types required for your headless channel.

Configure headless item

For existing content stored in the Content Hub, these headless items play a pivotal role. They need to configured to link with reusable content from the Content Hub, ensuring that this content, along with all its associated fields, is readily accessible through GraphQL queries.

Explained through an example scenario

Consider the following example use case for Xperience by Kentico's headless capabilities, which involves the management and distribution of location data as reusable content. In this example, a 'location' 🌍 content model contains details such as address and directions, and it is utilized across multiple web pages through various web channels.

With the headless functionality, this location data can now also be made available to external sources. By creating a headless item with a content item selector, these locations can be easily selected and offered from a central source.

Reusable content in headless item

Through the built-in GraphQL UI, it is possible to easily extract the entered location data from the system. Only a few configuration adjustments are needed, such as enabling the GraphQL API endpoints. Activating GraphQL introspection is not mandatory, but it is quite handy as it makes the GUI tools available for exploring the schema.

Enhance your channel's API security by using the GraphQlEndpointPath property to specify a custom and less predictable URL endpoint.

Then, we can easily retrieve our location data, including the data from the linked address content item from the content hub.

GraphQL result

In conclusion

The introduction of headless functionality in Xperience by Kentico is expected to significantly impact future projects. Headless activity tracking is already on the roadmap, and there's hope for expanding its capabilities to include various types of content from different channels. This indicates Kentico's commitment to evolving its headless capabilities to meet complex future needs. And with such advancements, opting for the headless channel will surely become a 'no-brainer' 😉

Top comments (0)