This is the CodeArt blog. This is where we share everything from tips & tricks to thoughtleadership articles or interesting code samples.
If you are looking for older blog posts published by Allan Thraen (Like those from labs.episerver.com or Allantech.com) you might be able to find them in our Archive.
Optimizely CMS: List content recursively on a page - and list the visitor groups used
Quite often a lot of the content on pages in Optimizely Content cloud (aka Episerver CMS) is structured in blocks placed in content areas. And often even blocks in blocks. Sometimes it's needed to quickly get a list of all the content items on a page - and sometimes you might also be interested in which visitor groups are used. Here is a couple of extension methods to help you with that.
Listing all endpoints in Optimizely CMS 12 / .NET 5
Routing has significantly changed in .NET 5 - and that affects many parts of Optimizely (Episerver) CMS 12. For example we have to get used to endpoints a middleware. As I am working on upgrading a few different add-ons I found it could be useful to see which routes are registered out of the box.
Anti-Pattern: Don't modify Optimizely CMS (Episerver) content objects in the Controller
Using your content object (CurrentPage / CurrentBlock) as a makeshift viewmodel where you change settings or extend it with user data in the controller before passing it to the view, is unfortunately (and to my surprise) a pretty wide-spread practice among developers implementing Optimizely (Episerver) web sites. But it really needs to stop.
Optimizely (Episerver): Split folder structure for blocks and media
Since version 7 or 8 of Episerver (now Optimizely CMS), the shared Blocks and Media have been sharing the same folder structure. Some people see a benefit with the shared structure, and some absolutely hate it. Personally, I have gotten used to it - but I was recently asked if it's possible to split it up. Here's the hack I came up with.
Experimenting with Wikipedia topics for Content
Automatically tagging your content with topics from a known, well described topic base like Wikipedia can have many cool uses. You can organize your content, suggesting keywords and outbound links, not to mention that you can build up interest profiles of your visitors. These interest profiles can the be used to suggest appropriate content and keep your visitors engaged. Inspired by Episerver Content Intelligence and a couple of earlier projects I've done in the past, I decided to perform an experiment to see how far I could get with a DIY approach as opposed to the traditional cloud-based NLP/AI.
Reading very large gzipped json files in c#
This is a little code snippet that I often find quite handy. It's a piece of c# code that opens a gzipped json file and iterates through the items in it. Since it takes it piece by piece (as opposed to loading everything in memory) it's can pretty much handle files of any size.