'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.
Solution 1:[1]
<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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | therkut |
