What is the role/usage of Category in Content tab of CMS?
This is similar to another question here:
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:
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.
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/
Just to clear something up: The categories are possible to translate for the end user, just not in the UI.
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>
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.
Hmm, yep good point Paul