Why I rebuilt my blog in Kentico Cloud

Rebuilding my blog in Kentico Cloud has been something that I have been planning to do for a good few months now. Having not really had the opportunity while trying to balance work with a hectic family life, Christmas and New Year 2017 afforded me some time to get my teeth into this project and to start adding some of the features and foundations that I wanted to really build this project up. This post is all about the things I learned along the way.

In November of 2016 I wrote a series of posts on building a blog in Kentico Cloud. As you might suspect, it was very much a work in progress. Kentico Cloud was still new, and I was very much experimenting with what it (and I) could do. The result was a website that has served me well, but it was basic.  Since November 2016, Kentico Cloud itself has come on leaps and bounds.  Because of this, some of the choices that I made to make life easier at the time no longer hold true.  In this post I'm really talking about the decision process around the choices I'd made and how I intended to streamline my blog production. 

Updates to Kentico Cloud

So, what changed in the last year or so?  Well, the Kentico Cloud team have been very, very busy. If you look at the product roadmap, not only can you see what they have planned, but also what they’ve achieved already.  

One of the key decisions I made back in 2016 was to use markdown to create my content.  I did this because I wanted much more control over my content and - being a developer - I wanted to be able to have things like code samples in my content.  With the Rich Text Editor (RTE) as it was at the time, I couldn't do that with the restriction on the formatting available.  With the introduction of modular content in the RTE, this is now a much easier thing to achieve .

Being a developer, I’ve primarily concerned myself with creating the application at a functional level, and so I only really tend to focus on the changes in Kentico Cloud that allow me to deliver content. To me, the key additions to Kentico Cloud over the bast year or so have been the following:

  • Required elements
  • Multiple-choice elements
  • Online images
  • Inline content links
  • Content element limits
  • Asset library
  • Modular content in RTE
  • .NET code generators
  • Webhooks
  • Enhanced link management
  • Taxonomy in the API
  • Content management API
  • Content type snippets

This is a staggering list of enhancements when you consider the flexibility that you gain for your content.  Last year, I wrote a post about the importance of content and how you should approach it.  A lot of the features added above reinforce this.  In fact, if you listen to Andy Thompson present, you'll get a good view of this too (go to 23:23 if you're in a rush, otherwise listen to the lot).

I'm not going to dig in to too much at a technical level just now (I'll follow that up in some later posts), but everything in this list made rebuilding this blog a walk in the park. 

Boilerplate

I already had my content setup in Kentico Cloud, what I was really looking at doing initially was rebuilding the web application with a little more best practice in mind. There is a whole heap of stuff on Kentico’s Github that can help you out with Kentico Cloud. The first port of call was the Kentico Cloud Boilerplate for ASP.NET Core MVC

This is a straight forward MVC application that will pull the top three articles from the sample project that comes when you create a Kentico Cloud account. Developed initially by Get Started and then subsequently maintained and developed by Kentico Cloud themselves, this is a wonderful place to start if you want to figure out the basics. Out of the box, you can see examples of:

  • Kentico Delivery SDK
  • Sample generated strongly-typed models
  • Sample link resolver
  • Simple fixed-time caching
  • HTTP Status codes handling (404, 500, ...)
  • Sitemap.xml generator
  • URL Rewriting examples
  • 301 URL Rewriting
  • www -> non-www redirection
  • Configs for Dev and Production environment
  • robots.txt
  • Logging
  • Unit tests (xUnit)

As I say, if you're new to Kentico Cloud, I can't recommend this enough for getting to grips with the .NET SDK.  I was up and running with this in about 20-30 minutes, pulling in content from my blog and starting to plan out some better features.  If you're going to explore Kentico Cloud, the boilerplate is a great place to start and i can really recommend it.

.NET code generators & inline content resolvers

What you notice with the boilerplate is that in the Models\ContentTypes folder, you’ll find two files that allow you to work with a strongly typed version of the Article content type.  You don’t need to hand-craft these files yourself, as yet again there is something we can grab from Kentico’s Github. This time it’s the .Net code generators. By providing you project ID and a couple of other values, you can generate the classes needed to support all your content models.  This is a great time-saver and well worth looking into as you build your project up.  Every time you change your content models, just re-run the command to regenerate your models.

For me this was a great improvement; I spent a lot of time on my first solution pushing JSON to views, which was frankly unnecessary.  Getting strongly type models with minimal effort made this job a breeze.  Go get them and play with them, they're great.

It was making a small proof-of-concept of inline content resolvers that formed the main basis of my rewrite.  I set up a simple sample in LINQPad to see what kind of things I could achieve.  Well, they were much better than I had expected and really.  As far as I know, this is a feature that neither Contentful or Prismic offer, and to me is a total killer feature.  The inline modular content is very much Kentico Clouds version of widgets, with these you can create a very fluid aspect to your content.   The content models provide the basic structures, but once you start using them inline, you open up a new world of possibilities.

Community documentation

If you start looking about on the Kentico Cloud Blog and the Developer Hub, you'll find heaps of content, tips, tutorials and discussions about features, and how you can use them.  I think one of the fairly powerful tutorials is one which creates a Hello World app in around 5 minutes.   I read quite a lot of content on here over Christmas and consumes a few videos on YouTube too, all in an effort to find out some better ways of presenting my content.  the key point here, this documentation is awesome, go read it.

Summary

If you've not tried Kentico Cloud yet, I hope the above give you the impression that it's something really simple to get to grips with.  Spin up a copy and take a look. If you experimented when it first came out and opted to use something else, I'd recommend you take another look now that it's more mature.