Mastering Flexibility in Sitecore: A Guide to Using Insert Options Rules for Enhanced Content Management

Unlocking the potential of insert options rules for smarter content structuring in sitecore

February 2, 2024

By Ryan Allan

When managing content in Sitecore, flexibility is key. Insert Options Rules are the hidden gems that offer this flexibility, allowing you to define the content creation process in a more dynamic and tailored way. Far from the traditional method of setting insert options on item templates, these rules open up a world of possibilities, simplifying the content creation workflow and offering a customizable experience for authors. This guide will dive into the what, why, and how of Insert Options Rules, giving you the insights needed to harness their power for your Sitecore environment.

What Are These Rules?

Insert Options Rules are what is says on the label, really. They let you define rules for adding new content in Sitecore and have more flexibility than the usual method of setting up options on item templates.

But wait, you say, that’s not clear enough! Well, I have a picture to make it better. Here’s the insert options popup:

Insert options in Sitecore

Here we can put in a folder or a hub page or a text page, in this example. You may not have the “insert from template” option on your Sitecore, depending on your access level, but don’t worry about that. This is all about making things easier for authors!

These rules let you change what appears on this popup, instead of having to go to the “Home” item template.

Why Would I Want Them?

There are two big reasons. The first one is that it lets you set up different parts of your site with exactly the content you want. Say you have an Article page. That’s great, very helpful, you need lots of articles on different subjects. Now, where do the Articles live? Well, you’ve got Landing Page templates, so you make a landing page called “Technology”. You assign “Articles” to the Landing Page template’s insert options and life is good.

You need other landing pages on other subjects, but that’s easy. So you set up a whole hierarchy, under a landing page called “Knowledge Base”. It’s got Technology, How-To, Product Deep Dives and other wonderful things. Great!

Now you’d like to reuse those articles in other places. You’ve got a “News” section of your site, and using an Article page as a news article is nice and easy, and the News page is already a landing page, so you’ve got that for free. Everything’s normal so far. But! Your company gets an award, and it doesn’t fit in your regular Article format, so you make an Award page. Or you’ve got an Event you want to highlight on your News page.

With regular Insert Options, you can add Events and Awards to the Landing Page, but oh no, now you’ve got Awards in your How-To insert list and your content authors are confused about what goes where. Sure, you could set the insert options specifically for the News page, but that’s not very future proof, is it? And you have to keep track of them in all sorts of places in the content tree as your site gets bigger.

The second reason is for multi-site setups. You’ve got your big main site and it needs everything everywhere, great. But you’ve got a few mini-sites you use for marketing campaigns, and they really only need articles. Your Spring Sale site doesn’t need Awards on its list of possible pages, let’s make it easier for the authors to put in what you need. Or they want to set up a new mini-site, and can save developer time and setup time by having the rules instead.

The Setup Section

First off, where do the rules live? They live in /sitecore/system/Settings/Rules/Insert Options/Rules. Yes, there’s a lot of built-in Sitecore options here, but you can add your own very easily. And you can add this part to your source control, making it much easier to maintain and deploy than custom rules on all sorts of content pages.

Insert options in Sitecore

There they are, at the very bottom of this image.

Making a new rule is straightforward. You just right click and pick “Insert Options Rule”, it’s the only one on the list. The rules use the normal Sitecore Rules Engine, and you might already be familiar with this from personalizing components.

Here’s an example that Sitecore uses in the marketing setup section:

Insert Options Rules in Sitecore

You can see that they are using the item hierarchy, inheritance, and templates all together.

Here’s the basic rules for the items, and the insert options themselves:

Setting up /sitecore/system/Settings/Rules/Insert Options/Rules

This means you can make a rule like “Where the Item has the template “Landing Page” add the Insert Option: “Article” and that covers your multisites, all your landing pages on the main site, and so on.

“Sure, but that’s exactly the same as adding it to the template!”, you might say.

Yes, and now we’re moving on to the fancy setup now that we’ve got a grounded point.

Notice that part about the item level? Lets say you want to keep your mini-sites, well, mini! Make a rule like “except where the item is MainSite or one of its descendants and the item level is greater than 2, remove the insert options Article and Landing Page”. There, your minisite can’t get any deeper than minisite.com/landing/category/article.

Set up a rule where every descendant of “News” can have “Awards” and now you don’t have to even think about the “Industry News” page you’re going to set up next quarter, it’ll just have the right options without impacting the other landing pages.

You can do even fancier things, like only letting the Marketing users create marketing items, or lock down a folder until a certain date. Or after a certain date, if it is a limited time event or marketing campaign content.

The Confusing Part

Now, you might have come here for a different reason. While very powerful, these rules don’t get used too often, and you can use them in combination with the normal method of assigning insert options on the templates and the individual items. So you might be a developer wondering “Where did these other six insert options come from? They’re not in any of the usual places.”

Now you know where to look and how to maintain those, too.

Harnessing the Power of Insert Options Rules for Streamlined Content Management

In conclusion, Insert Options Rules stand out as a powerful feature within Sitecore that can revolutionize the way content teams operate. By offering a sophisticated level of customization for content insertion, these rules facilitate a structured yet flexible environment for creating and managing digital content. Their true value shines in complex, large-scale, and multi-site setups, where traditional methods fall short. Whether you're looking to save on development time, simplify content authoring, or future-proof your content strategy, Insert Options Rules are an essential tool in your Sitecore arsenal. So, embrace these rules and watch as they transform your content management into an efficient, seamless process.



Ryan

Ryan Allan

Senior Developer

Ryan is a seasoned Senior Developer at Fishtank and is Sitecore Developer Certified. In a nutshell, he describes his role as "building extremely fancy websites". Ryan has a degree in Mechanical Engineering and previously worked on power plants and compressors, and now builds websites for the same company as a client! Outside of work, his interests are science + physics and spending time with his kids.