AI OnAI Off
Hi,
You can create a scheduled job that will read your file and based file data it will create the categories in the Episerver CMS
Example for creating a scheduled job-
https://blog.tech-fellow.net/2020/12/07/episerver-scheduled-jobs-under-the-hood/
Sample code to create categories-
private void CreateIfNotExists(string name, string description, int order)
{
if (string.IsNullOrEmpty(name))
{
throw new ArgumentNullException("name");
}
if (string.IsNullOrEmpty(description))
{
throw new ArgumentNullException("description");
}
var categories = CategoryList.LoadCategories();
if (categories.Contains(name))
{
return;
}
var category = new Category(name, description)
{
Available = true,
Parent = Category.GetRoot(),
SortOrder = order
};
category.Save();
}
FYI - If you have a multilingual site then you can use Geta Categories
We have a taxonomy managed by our organisation, and the taxonomy is stored in a file. The taxonomy is a tree consisting of categories (for example School category has subcategories Primary School and Secondary School, and Primary School has subcategories State Primary School and Private Primary School and so on). We would like Episerver to import the taxonomy, and use the taxonomy to categorise pages in Episerver for search etc. If the taxonomy changes in future, Episerver can reimport the taxonomy. Any suggestion is welcome. Thanks!