A layer in Orchard CMS allows you to control which pages a widget will appear on. When you install Orchard you get some layers already defined, but you can also add new ones based on rules like url “~/”. I wanted to create a layer based on the tags I had used for the pages content, so I needed a rule that looked at tags.
When I asked in the forum, it turned out there wasn’t a tagged rule, but it would apparently be easy to write my own. Writing a new rule was quite easy, but getting at the tag info wasn’t. However, with an awful lot of help from the Orchard Team I got one working and I’ve packaged it as a module that you can install from the Orchard Gallery.
How to create a tagged layer in Orchard
The tagged rule will allow you to create a layer that is visible on all pages that are tagged with a specified tag. You can then place widgets on this layer and they will be displayed on all pages covered by this layer.
First you need to install and enable the tagged module. Enable the gallery feature, so you can browse the Orchard Module Gallery. In the gallery find and install the Tagged module. Once it is installed you will need to enable the Tagged feature, which is under Layer rules.
Go to Manage Widgets and click Add a layer. Give your layer a name and a description.
In the Layer rule box you can now use the new tagged rule, like this:
Click Save and you’re done.
Once you’ve created a layer you can add widgets to it. If you need help with this, or you want to find out more, you can read the Orchard documentation about layers and managing widgets.