Migrating Episerver Categories to Geta Categories (EpiCategories)
Oct 11, 2019
Geta has created an alternative to the built in Episerver category system called EpiCategories. Its a well maintained and mature add on that adds some great capabilities over and above the built in category system in Episerver. It can wholly replace the built in category system and adds nice features like the ability to create/edit categories in edit mode, access rights, category routing and the ability to translate categories (amoungst others).
I wanted to migrate a site to start using Geta Categories but noticed the default package doesn't have any migration tools. So this post shares two scheduled jobs I wrote to do two things:
- Create Geta Categories based on existing Episerver category structure
- Migrate existing content to copy standard categories to Geta Categories
Create Geta Categories based on existing Category structure
This code takes the existing Episerver Category structure and copies it to Geta categories.
Migrate existing content to copy standard categories to Geta Categories
This job will look at existing categories on pages and create the same categories using Geta Categories.
Once both jobs have been run the old Episerver category structure (that was previosly only visible in admin mode) is available as Geta Categories in the main edit mode UI and also any categories previously selected are added to the content:
Implementation note
This implementation uses a category type called StandardCategory which looks as follows:
using EPiServer.DataAnnotations; using Geta.EpiCategories; namespace Foundation.Cms.Categories { [ContentType( GUID = "A9BBD7FC-27C5-4718-890A-E28ACBE5EE26", DisplayName = "Standard Category", Description = "Used to categorize content")] public class StandardCategory : CategoryData { } }
Further reading
- Find out more about EpiCategories here: https://github.com/Geta/EpiCategories
Finally
A big thanks goes to the team at Geta for building and maintaining this great open source tool!