Tag layers in Orchard

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:

Tagged "tag-name"

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.

Gideon said

said 14 March 2011 15:09:52 Any hopes to releasing your module as open source!!?

Richard Garside said

@Gideon the source is included in the module package. You're welcome to use it to base other modules on.

Doug said

Very cool! I saw the module in the gallery, but it took a while to find the info on your page on how to use it. Thanks for the contribution!

MEzzat said

Man, you did some nice job there i gotta give it to you i will try this and follow you up with my comments and how it did with me

thanks

MEzzat said

Thanks man works like a charm and can only say that it is such a great piece of work]

thanks again

Morgma said

Thank you for this module!

Coupled with language layer rule it really made localization much easier for my current project. It also opens up several other possibilities that I may have inappropriately applied Taxonomies to accomplish.

These simple, yet powerful, enhancements is what Orchard is all about!