Skip to main content
MindTouch Success Center

Display content only on a page with specifc tag

Conditionally display content only when a specific tag exists on a page.
  1. Open a page in Edit Mode and select Style > DekiScript from the Editor toolbar.
  2. 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."
    }
    
  3. 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)
  • Was this article helpful?