1

Using sitecore mvc 8.0 update 3.

I am trying to create a wildcard item that could be used to server at least 3 types of content items. For that I need to conditionally render few Controller Renderings based on template type.

Is that do-able? Maybe using Rules Engine? I am trying to avoid writing conditional logic in code.

I am not too familiar with Rules Engine any direction/guide will be really helpful.

2
  • + Question: Do I need to enable Analytics in order to Rules Engine to work for Conditional Rendering? Commented Jul 30, 2015 at 22:25
  • If you wish to use personalization rules, yes. For other types of rules, no. Commented Jul 31, 2015 at 13:27

1 Answer 1

1

One way would be to leverage personalization and swap controller renderings based on whatever rule you are using to determine 'template type'. You may need to create a custom rule, as I assume that your wildcard item that would be the context for the request has a single template type, and that is not the template you are referring to.

How are you determining the template for the request? However you are doing that can probably be used as the logic for a custom personalization rule.

Sign up to request clarification or add additional context in comments.

3 Comments

The wildcard item has template A (and has Controller Renderings assigned: R1, R2, R3). The content items that I want to render on it could be of template B, C or D. I just need to render Controller Renderings as following item types B (R1,R3), C (R2,R3) and D (R1, R2). So basically I want to add a condition on R1 that says hide if template == C.
Sounds like you just need a personalization rule on your rendering definition that checks for the datasource template. This assumes in your scenario that R1 is the datasource set for 'B'. How are you assigning these items to your rendering?
The datasource for R1 is same for Template B and D. I think it is more like if item of type C, then hide R1. Anyways, I do not have analytics enabled. I guess I wont be able to use personalization rule then.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.