November Happy Hour will be moved to Thursday December 5th.

Importing category data to Episerver CMS

Vote:
 

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!

#251311
Mar 24, 2021 14:57
Vote:
 

I would build a scheudled job that imports the taxonomy file from wherever it's stored then loads it in a processes it. The file can then process it using the category API to create/modify categories where needed and then yoou can programatically update pages using the content repository to tag them (if you have some sort of identifier between makes and the import data).

If you need to store any extra data on categories, I'd suggest using https://github.com/Geta/EpiCategories as it allow modelling of category information the same way you do other IContent items. 

#251312
Mar 24, 2021 15:35
Jianhan Zhu - Mar 25, 2021 10:12
Thanks for your helpful suggestions. Where to put the code to create categories, in the Initialization section, or as another scheduled job?
Scott Reed - Mar 25, 2021 10:59
Depends what your aim is. If the category list is fixed I would just manually create them in the CMS then have the code in the job linking them, if you need some sort of system identifier to tie the categories to your taxonomy file using Geta you could add a field on the category model for that. However if you're expecting either updates or new categories to come from your feed I would have the logic for creating/updating them in your job. Although I would be better architecturally to split this in to another service that the Job uses, then you can potentially test it or reuse it.
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.