Since the introduction of Kentico Cloud last year at the 404 conference in Las Vegas, I have been eager to start on a real life project. Luckily for me, I recently got the chance to get my hands dirty! With this post I hope to get you excited about the technology and help you kickstart your next .NET Core Kentico Cloud project!
Sign up and create a new Kentico Cloud project, it's free!
Kentico Cloud (SaaS) embraces the "scale with your business" model and allows you to start with a free plan. The prices page on the Kentico Cloud website provides a good overview of the different plans (free, professional and enterprise) and hints when to choose the one or the other. I believe that it makes sense to switch to the professional or enterprise plan once your application requires more API calls, demands more content editors (users) and/or when it targets an international audience in multiple languages.
Tip: Check out the products roadmap to get an idea of upcoming features.
Fork the boilerplate and contribute!
Tip: Please ensure you have the latest update of Visual Studio 2017, install the SDK and runtime from here. Finally upgrade the project to .NET Core 2.0
Content modelling in a headless world
I have noticed that I think differently now when it comes to architecting content for websites and web applications. In previous projects typically with Kentico's Portal Engine, the content modelling was driven by the (page) templates and website structure (sitemap). With Kentico Cloud this was not the case anymore. In our Kentico Cloud project the modelling was based on the following requirements and assumptions:
- Give editors flexibility to translate every piece of content
- Have a strongly typed setup to prevent the website from breaking if content is not present (translated) or when it is in a wrong format
This resulted in the following mix of content types:
Tip: You can use content type snippets to group content elements and reuse them in one or more content types.
- Pages: web pages that typically contains a title (H1) and rich text which can be accessed via the url slug
- Detail pages: similar to pages but created as specific content type (e.g. News, Event or Vacancy)
- Widgets: to add modular content blocks within rich text typically accompanied with settings like the title and which modular content to show in the widget (e.g. call to action widget or listing of specific content widget)
- Navigation groups: create a hierarchy of menu items with possiblity to specify the order (e.g. header and footer navigation)
- Resource strings: allows editors to specify (and translate) the value of (reused) labels (e.g. submit button text)
Leverage strongly-typed models via the Kentico Cloud model generator!
Flexibility comes with great power and responsibility. As developer in the land of Kentico Cloud, you can easily update your content types and add, change or remove content fields. While this does not directly influence published content, new versions of the content could potentially break your application if a field or value is different than expected or when it simply does not exist anymore.
To prevent this from happening we used strongly typed models. The Kentico Cloud model generator utility for .NET allows you to easily generate model classes via command line by just passing a couple of parameters among wich your Kentico Cloud project ID.
What I also like about the tool is that you can use it to validate if the models have unexpectedly changed or has been tempered with.
Tip: For structured rich text rendering add the --structuredmodel parameter.
Easily my favorite feature in any CMS is developing and offering widgets to our clients. In my experience widgets give editors an additional way of enriching the look-and-feel of content and create personalized experiences. This is also why it plays part of the content types in our project.
While in Kentico Cloud there is no called feature Widgets, the functionality can be achieved by rendering structured content placed inside the rich text editor (inline widgets):
In your MVC application this can rendered via display templates tied to the content models based on the widget content types in Kentico Cloud.
Tip: Please read the following article on how to setup structured rich text rendering in MVC.