Try our conversational search powered by Generative AI!

What is the role/usage of Category in Content tab of CMS?

Vote:
 

What is the role/usage of Category in Content tab of CMS?

#202257
Mar 21, 2019 8:50
Vote:
 

This is similar to another question here:

https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2018/4/what-are-categories-for-i39m-still-new-to-this-so-forgive-me/ 

The category property is intended to provide basic hierarchical taxonomy capabilities to Episerver sites though it's really down to you how you want to use it. In a few projects, we've used it to tag content with a topic which we then pass back into analytics so we know what content drives conversions. In other projects we've used it to identify the topic of a page and modify the styling of the content. If you've got find, you can use it to list/filter items of a given category. As an additional bonus, without writing any code of your own, you can add some categories to pages and use that to personalise content using the inbuilt "Visited Category" visitor group criterion so that, for example, you can show a picture of a dog to people who have viewed at least 10 of the 50 pages with the category of "Dog".

var categoryRepository = ServiceLocator.Current.GetInstance<CategoryRepository>();
foreach (var pageCategory in content.Category)
{
    var cat = categoryRepository.Get(pageCategory);
    //Do something with the category
}

You create the category structure within the admin section under the config tab. Typically I'll create a container for a given set of categories which I make not selectable then add the actual categories below. For example:

  • Topic
    • Topic 1
    • Topic 2
    • Topic 3
  • Animals
    • Dog
    • Cat
    • Walrus

And finally, there are a few limitations to be aware of, the main one being that, as you might see in the UI, Categories aren't translatable (or at least not through the UI) so, if you're working on a multilingual site, they may not be the right choice.

#202265
Mar 21, 2019 10:37
Vote:
 

We frequently use the Category property to "tag" Content. We find this helps to filter for Related Content using Episerver Find by Boosting results with the same Categories. 

query = query.BoostMatching(x => x.Category.Match(category), 4);


You'll find an excellent article on this here;
http://joelabrahamsson.com/related-content-with-episerver-find/

#202267
Mar 21, 2019 10:51
Vote:
 

Just to clear something up: The categories are possible to translate for the end user, just not in the UI.

I.e:

The norwegian translation
<templates>
 <categories>
  <category name="Kalender">
   <description>Kalender</description>
  </category>
 </categories>
</templates>


The english translation:
<templates>
 <categories>
  <category name="Kalender">
   <description>Calendar</description>
  </category>
 </categories>
</templates>

#202271
Mar 21, 2019 12:09
Vote:
 

That's a fair point Andreas. That approach works if you have a pre-defined set of categories which never change but, given that the language files require editing by a developer and deploying with the solution, that effectively means that you can't make changes to the categories without a deployment. Even if you're managing the language files through a plugin in the CMS, that's still effectively two separate tasks to manage the categories and languages so, unless you've got very fixed requirements for your categories or you're happy to have them in a single language, I'd avoid them for multi-lingual scenarios.

#202297
Mar 22, 2019 10:01
Vote:
 

Hmm, yep good point Paul

#202307
Mar 22, 2019 11:51
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.