How to show/hide webpart on specific document within one template

Customer care manager

Juraj Ondrus asked on November 6, 2009 02:37

How to show/hide webpart on specific document within one template

Correct Answer

Juraj Ondrus answered on November 6, 2009 02:37

When you’d like to display webpart within one page template only on specific document, it’s possible to take advantage of ‘Edit Value’ button in webpart properties. You can add following macro expression for ‘Visibility’ property:

{%cmscontext.currentdocument.documentname|(equals)Home%}

Please note, you can place whatever document name instead of "Home". This will enforce that webpart will be shown on document with that name. You can find more about macros in our Developer's guide.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Chetan Sharma answered on April 9, 2016 12:55 (last edited on April 9, 2016 12:56)

Hi Juaraj,

    We can also accomplish based on Show for Page Types field. Let's say that you have multiple page types sharing a page template and you want to show it specifically for "PT - Home". You can make use of the above property and check the page types you want the webpart to render on.

p.s - we use this approach very often.

Thanks,
Chetan
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.