Urls and Classifications
I have created two simple classifications, can I create a url that will filter on both classifications? Or do I have to make a hierarchical classification in order to get this behaviour?
Thanks
Hello,
You cannot filter by multiple classifications in the URL. You can however, achieve this using our API.
You can find below a sample that filters News items based on 2 custom classifications (Custom tags and Geographic regions):
using
System;
using
System.Linq;
using
Telerik.OpenAccess;
using
Telerik.Sitefinity.GenericContent.Model;
using
Telerik.Sitefinity.Model;
using
Telerik.Sitefinity.Modules.News;
...
var newsManager = NewsManager.GetManager();
Guid customTagId = Guid.Parse(
"bb474327-016d-6bce-b4b3-ff0000fe52e7"
);
Guid geographicRegionId = Guid.Parse(
"d34c4327-016d-6bce-b4b3-ff0000fe52e7"
);
var newsItems = newsManager.GetNewsItems()
.Where(n =>
n.Visible
&& n.Status == ContentLifecycleStatus.Live
&& n.GetValue<TrackedList<Guid>>(
"customtags"
).Contains(customTagId)
&& n.GetValue<TrackedList<Guid>>(
"geographicregions"
).Contains(geographicRegionId)
);
Thanks Velizar,
It's not quite a nice from an SEO perspective. Where /property-to-rent/London/2-bed would work better. But I guess the only way to achieve this would be to have a hierarchical classifications. Where for each place, you would have a sub-category of 1-beds, 2-beds, etc.?