Last active
January 22, 2023 17:03
-
-
Save oliverdoetsch/153334604fdda9fe9191 to your computer and use it in GitHub Desktop.
Blogger: Globally conditional data tags for all page types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#AND | |
<b:if cond='data:blog.pageType == "index"'> | |
<b:if cond='data:blog.searchQuery'> | |
<!--search_page AND index_page--> | |
</b:if> | |
</b:if> | |
#OR | |
<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "p/foo.html"'> | |
<!-- static_site foo OR static_site bar --> | |
<b:else/> | |
<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "p/bar.html"'> | |
<!-- static_site foo OR static_site bar --> | |
</b:if> | |
</b:if> | |
#NOT | |
<b:if cond='data:blog.pageType != "index"'> | |
<!-- all pages NOT index pages --> | |
</b:if> | |
<b:if cond='data:blog.url != data:blog.homepageUrl'> | |
<!-- all pages NOT homepage --> | |
</b:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b:if cond='data:blog.pageType == "archive"'> | |
<!--archive_Page--> | |
</b:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b:if cond='data:blog.pageType == "error_page"'> | |
<!-- all error pages--> | |
</b:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b:if cond='data:blog.pageType == "index"'> | |
<!-- all index pages --> | |
</b:if> | |
<b:if cond='data:blog.url == data:blog.homepageUrl'> | |
<!-- only homepage --> | |
</b:if> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b:if cond='data:blog.pageType == "item"'> | |
<!-- all item pages --> | |
</b:if> | |
<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "2014/08/foo.html"'> | |
<!-- a item page from august 2014 with post-title 'foo'--> | |
</b:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b:if cond='data:blog.searchLabel'> | |
<!-- all label pages --> | |
</b:if> | |
<b:if cond='data:blog.searchLabel == "foo"'> | |
<!-- for label 'foo' --> | |
</b:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b:if cond='data:blog.searchQuery'> | |
<!-- all search pages --> | |
</b:if> | |
<b:if cond='data:blog.searchQuery == "foo"'> | |
<!-- for query 'foo' --> | |
</b:if> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<b:if cond='data:blog.pageType == "static_page"'> | |
<!-- all static pages --> | |
</b:if> | |
<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "p/foo.html"'> | |
<!-- a specific static page with name 'foo' --> | |
</b:if> |
is there a way to create conditional tag for multiple specific pages?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the conditional tags. It's really helpful for blogger users. In addition to this, I'm adding a link here to get the SEO optimized header tags for blogger themes.