Abstract your Crumbtrails

By Deane Barker

When you have a “pure” crumbtrail – one that is based on a page’s position in the larger content geography and nothing – problems can result. It’s easier if you abstract this, and other navigation, away from the content structure.

Here’s a really, really esoteric CMS implementation tip: abstract your crumbtrails. What I mean is to make sure your crumbtrails can be generated from something other than the content in the CMS. I’ve finally learned this for good. I’m in a middle of an Episerver implementation now. Episerver has a…

The document provides a tip for implementing CMS, emphasizing the importance of abstracting your crumbs trails. This means ensuring that the crumbs can be generated from sources other than the content in the CMS. The author suggests creating an abstraction layer for crumbs, such as a method for “AddCrumb trailSegment”, which can be used to form or add segments to existing crumbs.

Generated by Azure AI on June 24, 2024

Here’s a really, really esoteric CMS implementation tip: abstract your crumbtrails.

What I mean is to make sure your crumbtrails can be generated from something other than the content in the CMS. I’ve finally learned this for good.

I’m in a middle of an Episerver implementation now. Episerver has a strong content tree, so I wrote a quick control to iterate through a page’s ancestors and form up a crumbtrail. This is great…until you get one of these situations:

  1. You have a page not in the content structure of the CMS. Some page that sits outside the CMS. In any project of appreciable size, you will have these.

  2. You have a page that maps to a single content item, but has different logical states which require different crumbtrail navigation. Based on certain criteria, the page might have more than one state, but insofar as the CMS is concerned, it’s the same content object, so the crumbtrail is the same.

You need to have an abstraction layer for crumbtrails. You should have some method for “AddCrumbtrailSegment” which takes a title and a URL. Then, if you have a page outside the CMS, you can form a crumbtrail from scratch, or, with a single call, you can add a segment to an existing crumbtrail.

If you’re working with a page that’s solidly in the CMS, feel free to use the CMS structure to form up the crumbtrail, but use your abstraction layer to do it. In the end, forming the crumbtrail from the CMS structure should be one way to do it, not the only way to do it.

This tip probably holds true for any navigation element in the outer layout of a CMS template – general navigation, footer items, overhead static menu items, etc.

Told you it was esoteric.

This is item #142 in a sequence of 357 items.

You can use your left/right arrow keys to navigate