One often overlooked aspect of maintaining an Episerver website, is making amends as the business wants it. As new campaigns, products, content, news, updates come out, it's very common that layouts or pages will need amending. When the requirement involves a change to existing value types, things can get tricky. Back in my early days of development (pre Ci/Cd), I remember one project needed a property on the homepage to change. That one simple line took down the whole site. Granted it was out-of-hours, but anyone new to Episerver should appreciate this fact before they start making amends. In today's post, I'm going to explain the main options available to you when you need to change an existing property.
1. So the first option is probably a cop out for anyone reading this and needing to change a type, as when you are initially designing pages/blocks it's good to keep in mind that, as time progresses, the site will change. The easiest way to cater for these future changes is to choose the most flexible Episerver properties. On a recent project, the requirement was to build a hero banner in the header of the start page.
One way to build that would be to add three properties to the homepage page type, a picture, and title. In the future, it was very likely that the client would want to use a carousel. A more flexible approach in this example was to create a hero block and add a content area on the homepage, locked down. To add a carousel to the homepage later would be as simple as creating a new block and allowing it onto the homepage. Developing for maximum flexibility makes maintenance a lot easier.
I also want to point out, that I'm definitely not advising to create everything as blocks. When designing an Episerver website I still think the fewer blocks you create within an Episerver website, the easier it is to maintain. On certain key pages (like a homepage) the chances are extremely high that the content will change. Deciding what to cater for the future, or, what to keep in a template is a bit of an art. This sort of decision is where experience with the platform comes into play. Some simple truths are to make the homepage and landing pages flexible, try to stick with a template first approach for everything else.
2. Create a new page/block. If you need to change an existing page/block, then a good option to consider is to create something new and use that rather than try to change an existing component on the website. This is another safe approach, as when you release your code you won't break anything. The downside of this approach is that you might create some duplication. In an e-commerce site, it's better to have duplication sometimes than taking the website down for a few hours.
3. If you have to change a property on an existing block/page my advice is to create a new property, rather than try to change an existing properties type. After you have gone 'live' you can then delete the old unneeded property, this approach is a lot safer as it shouldn't take your website down. One thing that might be useful to know is that if you delete a property in code, that won't automatically delete the data from the DB. If you delete a property and then try and view it in the admin sections -> content type tab -> page type. If you inspect the page properties, you will still see the property defined with the word 'missing'next to it. Only when you delete that property via the admin will all the data be fully deleted.
4. If you have to change the type of an existing property. TEST, TEST, TEST! Back-up your DB, cross your fingers and hope it goes ok. In some instance it will, others it won't... don't say you haven't been warned!
Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge