This guide helps you with developing your Redakt based web application project. The sections below assume you have already set up the basic configuration for your application, including a working connection to a database. See the Getting Started guide if you have not done so yet.
After you have installed and configured all the modules that you require for your project, you can begin with the actual code development of your applications. In most cases, you start with defining your content models. They are required for any sort of content management function to work. If you are using Redakt for server-side page rendering, you would typically also develop your Razor views alongside your content models. If you are using Redakt for headless operation only, you do not need to develop Razor views.
Before continuing with implementing your application, it's a good idea to read about the Redakt object hierarchy to understand how different objects in the Redakt system relate to each other.
Content models
Every node (page or asset) in the system contains content of a certain content type. The properties that a content manager is able to edit for a specific content type are defined in a content model. For Redakt, these content models are defined in code (as opposed to in a database, which is common for many CMSs). Defining your content models in code has a couple of advantages over defining them as data:
- Your models will be deployed together with your application code across all your (DTAP) environments without having to re-enter content definitions for different environments over and over again.
- You will have a full history of your content models in source control.
- Content models allow for strongly typed view models in your Razor views.
Redakt content models are created as simple POCO classes. The properties on these classes are the fields that are available for editing in the Redakt back office. Attributes on the classes and properties determine behavior and validation, for example, to specify a rich text editor, to mark a field as required, to validate for min/max values, etc. You can even nest other content models to create a complex multi-layered content model.
To start creating your content models, read the content model implementation guide here.
Views
Views are the templates that render your content to HTML. For Redakt, they are common ASP.NET Core Razor views. Redakt views inherit from a base RedaktPage<TModel>
class, a generic view class where TModel
is a content model type that you have created earlier. The RedaktPage<TModel>
class contains helpers for common Redakt functions and the strongly typed content model for that page. Several custom Razor tag helpers are available to make the integration of Redakt content even easier and more declarative.
Read here about developing views for your Redakt application.