Common Configuration: Conditional

Conditional is a configuration for managing widget availability. This configuration is one of the general settings available for most widgets. Through this configuration you can activate a widget only on specific page types, devices, or URLs.


Conditional Types

There are 2 types of conditionals: Positive Conditional and Negative Conditional.

  1. Positive Conditional is a condition that will display the widget when any of the items (page, device, or URL) in the value are met.

  2. Negative Conditional is a condition that will display the widget when none of the items in the value are met.



Defining Values

Format
         
           {{item1, item2, itemN}}
         
      
         
           !{{item1, item2, itemN}}
         
      
  • item refers to a Page, Device, or URL
  • Separate each item with a comma

Item: Page Type
Page Type Value Description
Homepage homepage Main page
Search By Label search_by_label Label page
Search By Query search_by_query Search page
Search By Published search_by_published The page when user browse blog posts
Post post Post page
Page page Blog page
Archive archive Archive page
Error error Error page

More information about page types can be found on the page: Page Types and Names
Item: Device
Device Value Description
Desktop desktop Desktop device
Mobile mobile Mobile device
Item: URL
For URL items, the system will ignore protocol and www. The following three URLs will be considered the same:

        
          https://www.domain.com
          http://domain.com
          domain.com
        
      



Examples

Example of Positive Conditional
             
               {{homepage}}
             
          
Displays the widget only on the Homepage type page.

             
                {{homepage, post}}
             
          
Displays the widget only on Homepage or Post pages.

Example of Negative Conditional
             
               !{{homepage}}
             
          
Displays the widget if the active page type is not Homepage.

             
                !{{homepage, post}}
             
          
Displays the widget if the active page type is not Homepage and Post.


       
          !{{search_by_label, mobile}}
       
    
The widget will be displayed if the active page type is not Search By Label and the device used is not Mobile. Here, according to the negative conditional rule, even if the active page type is not Search By Label, if the device used is Mobile, the widget will not be displayed.

       
          !{{page, https://www.domain.com/2022/04/title.html}}
       
    
Displays the widget on page types other than Page and the URL is not https://www.domain.com/2022/04/title.html.
Have Question?