4 YEARS AGO

Tips for maintaining relationships (a.k.a. relationtips)

Almost every Kentico project will require you to configure a solid information architecture. In this blog post I will cover several options on how to capture and present related content.

Option 1: Related pages

Maybe one of the easiest ways to present related items is to leverage the built in relationship names module. When you create a new site you will most likely come across the default relationship "is related to". This relationship is used within pages, to create a relationship between one ore more pages. What's nice about this is that the editor can control the side of the relationship. This for example allows the editor to display news items related to the current news item but not display the current news item on the related news pages.

Related pages
To display the related pages simply add the "related pages" web part. The configuration is quite similar to the configuration of repeaters.

For more info check out "Displaying related pages" in the documentation.

Personal note
I would recommend this option when you want a quick out-of-the-box solution and if the side of the relationship matters. Be aware that it will take some time to create the relationships, as it requires several clicks to select (and find) the related page. You could consider providing a different (or custom) form control to select the related items.
 

Option 2: Categories

When configuring the information architecture in Kentico you should have come across the need for a taxonomy. The taxonomy normally shows a tree that breaks down classifications and sub-classifications. A great fit to this description is Kentico's categories module.

Categories

Categories can be easily maintained by editors and be used to classify pages. If you take a close look at the listing and viewer web parts like the repeater and universal viewer, notice they have a property to select a category.

Select category

If you combine this with the power of K#, you can easily populate a list of related items based on the category of the current document.

Repeater with power of K#

For more info check out "Configuring categories" in the documentation.

Personal note
If you are looking for a more automated way of displaying related items then I would recommend to go with categories. A small downside to this approach is that by default it only supports a 1-on-1 relationship. In order to work with multiple categories you will have to do some additional work like adding a where condition like the following one:

([NodeID] != {% NodeID %}) AND ([DocumentID] IN (SELECT [DocumentID] FROM [CMS_DocumentCategory] WHERE [CategoryID] IN (SELECT [CategoryID] FROM [CMS_DocumentCategory] WHERE [DocumentID] = {% DocumentID %})))
 

Option 3: Tags

This is actually quite similar to the categories and usually acts as the thesaurus of the information architecture. Kentico MVP Brian McKeiver submitted a nice and free web part that you can download and install to display related blog posts based on tags.

McBeev's web part goodness

You can download the web part from the Kentico marketplace.

For more info check out Brian's blog post "Free Web Part for Kentico - Related Blog Posts by Tag" at www.mcbeev.com.
 

Option 4: Linked items

Sometimes you just want to get something done quick and easy and select a couple of items to highlight and display in for example a slider or carousel. In these cases you could use one of the previous options, but you could also consider using linked items. Linked items is a powerful mechanism that allows you to create one ore more "siblings" of a page. If you modify the original page or any page that is linked to it, the change will be automatically visible on the others as well.

Link an existing page

Simply add a repeater web part that lists the linked items and you're all set :)

Personal note
I love to work with linked items as it is very useful when you want to share content within a site or between multiple sites. Be aware that you might have to do some tweaking if you want to ensure unique content (consider canonical links or apply 301 redirects).
 

Wrapping up

This posts covered 4 simple options how to leverage out-of-the-box Kentico features to display "related" content. Looking forward to get your feedback on how you typically handle the listing of relationships. What is your favorite?

Hope it helps!