Ill explain a little what it is conditional tags. Conditional tags arebr />limiting a program command on certain conditions use a
I'll explain a little what it is conditional tags. Conditional tags are
limiting a program command on certain conditions use a specific syntax or
in plain language is a process where the process under certain conditions
should be done or not done. I guess you already know who the notion of
conditional tags, set out alone.
Further, like other programming languages like php,
javascript, and so forth, blogger or blogspot also have conditional tags.
From what I learned conditional tags bloggers tend to be a little, easy and
simple compared to other tags conditional.
Here I am trying to register right some conditional tags in blogger or
blogspot that may be useful to you in making and editing templates.
condition #and
In layman's language if the conditions A and B conditions are met then run
this command.
In logic, yes.
<b:if cond='data:blog.pageType == "index"'> <b:if cond='data:blog.searchQuery'> <!-- Perintah ini dijalankan di halaman search_page AND index_page --> </b:if> </b:if>
condition #OR
In layman's language if either condition A or condition B is met then run
this command.
In logic, yes.
<b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "p/foo.html"'> <!-- Perintah ini dijalankan di halaman static_site foo OR static_site bar --> <b:else/> <b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "p/bar.html"'> <!-- Perintah ini dijalankan di halaman static_site foo OR static_site bar --> </b:if> </b:if>
condition #NOT
In layman's language if it is not in condition A, then run this command.
In logic, yes.
<b:if cond='data:blog.pageType != "index"'> <!-- Perintah ini dijalankan pada semua halaman NOT(kecuali) halaman index pages --> </b:if> <b:if cond='data:blog.url != data:blog.homepageUrl'> <!-- Perintah ini dijalankan pada semua halaman NOT(kecuali) homepage --> </b:if>
Ok I guess up here you already know about the logic of the conditional tag
blogger or blogspot use if then else of API blogger.
Cont. Here is a list of specific conditions for a conditional tag in
blogger or blogspot
In the archive page.
<b:if cond='data:blog.pageType == "archive"'> <!-- Perintah ini dijalankan pada semua halaman archive--> </b:if>
On the page or 404 error.
<b:if cond='data:blog.pageType == "error_page"'> <!-- Perintah ini dijalankan pada semua halaman error --> </b:if>
In index_page.
<b:if cond='data:blog.pageType == "index"'> <!-- Perintah ini dijalankan pada semua halaman index --> </b:if> <b:if cond='data:blog.url == data:blog.homepageUrl'> <!-- Perintah ini dijalankan hanya di halaman homepage --> </b:if>
In item
<b:if cond='data:blog.pageType == "item"'> <!-- Perintah ini dijalankan pada semua halaman item --> </b:if> <b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "2014/08/foo.html"'> <!-- Perintah ini dijalankan hanya pada halaman item dengan url namablog.com/2014/08/foo.html--> </b:if>
On page labels
<b:if cond='data:blog.searchLabel'> <!-- Perintah ini dijalankan pada semua halaman label --> </b:if> <b:if cond='data:blog.searchLabel == "foo"'> <!-- Perintah ini dijalankan hanya pada halaman label dengan nama label 'foo' --> </b:if>
On the search page or search
<b:if cond='data:blog.searchQuery'> <!-- Perintah ini dijalankan pada semua halaman pencarian atau search --> </b:if> <b:if cond='data:blog.searchQuery == "foo"'> <!-- Perintah ini dijalankan hanya pada halaman pencarian dengan kata kunci 'foo' --> </b:if>
In the static page
<b:if cond='data:blog.pageType == "static_page"'> <!-- Perintah ini dijalankan pada semua halaman static atau statik --> </b:if> <b:if cond='data:blog.url == data:blog.canonicalHomepageUrl + "p/foo.html"'> <!-- Perintah ini dijalankan hanya pada halaman statik dengan nama halaman 'foo' --> </b:if>
In the mobile custom template
<b:if cond='data:blog.isMobile == "true"'> <!-- Perintah ini dijalankan pada semua custom template mobile --> </b:if>
Other conditions you can try search templates, respectively, such as you
find the following conditions:
<b:if cond='data:post.thumbnailUrl'> <!-- Perintah ini dijalankan jika ada perintah data:post.thumbnailUrl --> </b:if>
This means that if
a data command: post.thumbnailUrl
not materialize or null then the tag inside the command will not be
executed.
Sample case: I do not want to show
<div class = "gmr"> Hello I is an HTML element </ div>
on a page other items that please be displayed, from here we can read the
corresponding logic.Then you have to do is insert a tag as follows:
<b:if cond='data:blog.pageType != "item"'> <div class="gmr">Halo saya adalah element HTML</div> </b:if>
Programming should not you memorize all the existing tags, but how do you
create a logic program that can be run in accordance with our wishes or in
a cool language programming algorithms.
Easy is not it. Please play with the existing conditional tags, conditional
tags are still many who do not I have written above.