Hoofer
Hoofer

Reputation: 13

Blogger Conditional Tag If a Post has Spesific Label

im trying to Execute some Javascript code like this

<b:if cond='data:blog.pageType == "item"'>
  <script type='text/javascript'>
    //<![CDATA[
    
    var myModal = new bootstrap.Modal(document.getElementById('dark-Mode'), {})
    myModal.toggle()
    document.querySelector("#mainCont").classList.add("drK")
    
    //]]>
    </script>
</b:if>

that script is work fine, but the problem is I only want to execute it in post page that has a spesific label. Let say that the Dark Mode is automaticaly Turned On in Post that has Games label. Im new to Blogger platform, how exactly to do that.

Upvotes: 1

Views: 609

Answers (1)

therkut
therkut

Reputation: 21

<b:if cond='data:blog.searchLabel == "game"'>
<!-- for label 'game' -->
  <script type='text/javascript'>
    //<![CDATA[
    
    var myModal = new bootstrap.Modal(document.getElementById('dark-Mode'), {})
    myModal.toggle()
    document.querySelector("#mainCont").classList.add("drK")
    
    //]]>
    </script>
</b:if>

source: ultimatebloggerguide

Upvotes: 1

Related Questions