I have been working with episerver for 2-3 months now on an existing project - its my first time using this CMS, so far so good, pretty solid starting to like episerver :-)
But one thing I have noticed is that on pretty much every Page Type and Block Type you have a field called category under the content tab. What is it for, we are not using any categories in our project, I have a feeling we are overlooking a bit built in episerver feature.Is it possible to remove it, if we are not using it?
Some real examples of how to use this and what its for would be appriciated. - How this is not a really stupid question :-)
Thanks in advance.
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".
You can access it using the CategoryRepository:
var categoryRepository = ServiceLocator.Current.GetInstance<CategoryRepository>();
foreach (var pageCategory in content.Category)
var cat = categoryRepository.Get(pageCategory);
//Do something with the category
The categories property is used across the CMS content types by virtue of the fact that they implement ICategorizable so, while you can remove the category property, it's not very obvious how to do it. Luckily, Joel Abrahamsson put a guide together here:http://joelabrahamsson.com/hiding-episervers-standard-category-property/
I hope that helps,
One other thing I should mention in case you haven't found it yet - 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.