Layout service API

Overview

Using the Page layout service API, you can manage the communication between Single Page Applications (SPAs) and your Sitefinity CMS backend. In this scenario, Sitefinity CMS no longer handles the frontend rendering of your pages and content. Instead, you write a dedicated frontend application (SPA) that accesses the content and the layout from the backend. The Page layout service API handles the communication between such apps and the Sitefinity CMS backend using standard OData REST API.

Configure the Page layout service

To ensure that your frontend app can access the content from the Sitefinity CMS instance, perform the following:

  1. Log in Sitefinity CMS backend with an administrative account.
  2. In Sitefinity CMS backend, navigate to Administration » Web services.
  3. Click the Default web service.
  4. Inside section Who can access the content by this service?, select Everyone.
  5. In Allow access from other domains, set the domain where you host your frontend app. For example - http://frontend.sitefinity.com. You can use * to allow access from all domains.
  6. Click Save changes.

For more information, see Web services.

RESULT: The Page layout service is activated and ready to serve content to your apps.

Expose additional content types through Page layout service

By default, with Sitefinity CMS Page layout service, you can expose the following content to your frontend applications:

  • Content block (MVC)
  • Pages (Pure MVC)
    For more information, see MVC modes.

To expose other widgets, perform the following:

  1. Log in Sitefinity CMS backend with an administrative account.
  2. Navigate to Administration » Settings » Advanced » Pages.
  3. In the property Enable new Admin App widget designers for specific widgets, enter a comma-separated list of widgets that you want to be exposed through the Page layout service.

    EXAMPLE: NewsController, PressRelease, MessageWidgetController.

    Where:
    • NewsController is the SimpleName for Telerik.Sitefinity.Frontend.News.Mvc.Controllers.NewsController representing the default MVC News Widget.
    • PressRelease is the name for the dynamic MVC widget for handling the dynamic content type- Press release. The name PressRelease is the developer name of this content type.
    • MessageWidgetController is a custom widget as one defined in Create and register widgets.

GitHub sample

After you have set up your Sitefinity CMS instance, you can develop your frontend application. The Progress Sitefinity CMS sample frontend renderer app GitHub repository contains the following samples in the listed branches:

  • Master
    This branch contains a starter kit with a blank app, based on the Angular framework. Use it as a starting point for developing your apps when you want full control over the code structure.
  • quantum-landing-page
    This branch contains a sample app with code that demonstrates how to use the Page layout service API to consume and present content and layout. Use it to learn how to build an Angular based frontend app.

You may use these samples to learn the Page layout service API and how to integrate it into your frontend app.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?