Display content only on a page with specific tag
- Applies to:
- All MindTouch Versions
- Role required:
- Draft Contributor
Conditionally display content only when a specific tag exists on a page.
- Open a page in Edit Mode and select Style > DekiScript from the Editor toolbar.
- Copy the following code and paste it into the DekiScript field, replacing mytag with your desired tag:
if ( map.contains(page.tags,"mytag") ){ "This text is only displayed if a page contains the tag listed above." }
- The text within the "{ }" curly brackets will only be displayed when a page contains the tag "mytag".
Functionality
- The conditional content can include CSS, HTML, or standard text.
- Quotes should only appear at the beginning and end of the conditional content (double quotes within the conditional content will cause an error)