Monday, 22 June 2015

How to display/hide a Sublayout based on language

Leave a Comment
Recently I’d stumbled upon a post on Sitecore Community regarding how to display/hide a Sublayout based on a language version.

Original question: We have one presentation control (Sublayout) added in one Page. But we need to restrict for some specific language versions. How to do this?

We can achieve this functionality using Personalization. Select the Sublayout which you want to display/hide and personalize the Sublayout by creating new personalization condition.  See below screenshots to understand how to personalize the component.




This is how page is looking when hide component checkbox is unchecked.


This is how page is looking when hide component checkbox is checked.

If you're using Sitecore 8, then you can achieve same functionality by using versioned layouts too. You can configure presentation details of each language independently. Check this documentation which shows how to work with versioned layouts. Comments and suggestions are most welcome. Happy coding!

0 comments :

Post a comment