Sitecore Feature Flags Module
I would like to introduce a module that I have been working on for a while: Sitecore Feature Flags!
What is it?
I should have probably named it Sitecore Feature Rules
or Sitecore Dynamic Features
, but Sitecore Feature Flags
is an interpretation of Feature Flag
development built within Sitecore
. Instead of an item with a master list of all renderings/modules and a toggle
or flag
that enables or disables specific components, this module utilizes Rules
to enable or disable modules at the point of Content Entry. Why? Because rather than executing logic on every request to determine if a rendering/module should be displayed to an end user based on some curated list, let’s focus on “guiding” the content editors away from modules that are works in progress but deployed. Given this is more of a conditinal rendering
using Rules
approach than it is a flag|toggle
approach, it actually gives a tremendous amount of power to Content Editors than just enabling and disabling modules; it allows controls to be allowed based on any rules in Sitecore (specific users, specific tree loctions, even a macro to determine what Site
you may currently be under).
To illustrate what this means, let’s assume you have a Sitecore instance with 2 sites, one being a global site and the second being a region specific sub-site. Let’s also assume that you are creating a new module and your creative team has only given you designs for the global instance. Instead of managing the controls by creating a seperate page template
and placeholder setting
for the sub-site, you can levarage one shared placeholder setting
but only allow the global site to use that control using Sitecore Feature Flags
module, defining a rule to only allow the control in the placeholder if it’s current site is Global
.
What does it do?
- Under the hood 2 new processors are added via
Sitecore.FeatureFlags.config
to the followingpipelines
:getPlaceholderRenderings
to execute the logic to add/prune allowed controls inExperience Editor
.getLookupSourceItems
to execute the logic to add/prune allowed options when atemplate
inherits from_Module Options
base template.
What do I need for it?
- Sitecore and the installation package at a minimum. Has been tested on 8.2, and 9.0
What do I need if for?
- If you want to be able to deploy your site changes without having a module/component completely buttoned up
- If you want to have more dynamic control of your modules
- If you want to minimize your
placeholder setting
definitions
How do I use it
Should be as easy as:
-
Install the package in Sitecore Packages
-
When creating a new/editing an existing
placeholder setting
, look for theAllowed Modules Rule
field. Define your rules here and look for theFeature Flag
tagged rules and actions. These will allow you to filter modules bySite
and use theallow|block control on this item
-
When creating a folder that stores arbitrary data items (ie: tags, background colors, styles etc) use the
Module Options Folder
or use the_Module Option
base template to give you the ability to use theFeature Flag
rules on said folder. This will give you the ability to exclude child times from a list when this folder is used as a datasource (ie: exclude theGrey Background
style from the Global site). This allows you to keep one source of truth for your datasource rather than having to have separate folders per site. -
When creating data items that may sit under a page type (think
About Us/_content/Hero
) you can leverage theSiteInfo
macro inFeature Flags
to block that item from being inserted using the standardInsert Options
rule for specific sites if the module is not ready to be used.
Video
Video of usage (creating a rule on the placeholder setting
to remote the Sample Rendering 2
component from all sites except for Global
):
Video of usage (creating a Modules Options
folder with child items) that is referenced in the Sample Item
template. Created rule excluding Green Background
from everywhere other than Global
.
Screenshots
Look for a more in-depth write up soon on Geekhive’s website and hopefully on Marketplace as well.
Hope this helps!