Summarizes all the conditional cards in Blogspot

Summary of conditional tags in Blogspot - This article is for those who are looking for ways to optimize the speed of their Blog, as well as for those who are learning about Blogspot Template Design, you are learning about the background. Blogger, ....
Blogspot is currently a "HOT" platform This article is for those of you who want to optimize the speed of the blog or you are learning about Blogger Template Design, you intend to learn more about the Blogger platform. , ...

Using


Conditional tags allow us to dynamically adjust gadgets, JS snippets that work on certain pages for maximum efficiency. For example, I have a code that I just want it to work when viewed by computer, but will not work when viewed by mobile, I will use the condition card as follows:
Summarizes all the conditional cards in Blogspot
Summarizes all the conditional cards in Blogspot


<b:if cond='data:blog.pageType != "data:blog.isMobile"'>
// The code snippet only works on the computer
</b:if>

Blogger Conditional Tags


Here are some Blogger conditional cards that I know of. If you lack any then you add help in the Comment section nhé!

1. Conditional card for home page, search label page, archive page:

<b:if cond='data:blog.pageType == "index"'>
2. Conditional card for posts.

<b:if cond='data:blog.pageType == "item"'>
3. Conditional cards for static pages:

<b:if cond='data:blog.pageType == "static_page"'>
4. Conditional card for archive page:

<b:if cond='data:blog.pageType == "archive"'>
5. Conditional card for home page:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
6.Conditional cards for certain URLs:

<b:if cond='data:blog.url == "URL nhất định"'>
7. Conditional cards for Page and Post:

<b:if cond='data:blog.url == data:post.url'>
8. Conditional cards for all labels:

<b:if cond='data:blog.searchLabel'>
9.Conditional tags for certain labels

<b:if cond='data:blog.searchLabel == &quot;Tên nhãn&quot;'>
10. Show content for the first post at home

<b:if cond='data:post.isFirstPost'>
11. Conditional card for mobile:

<b:if cond='data:blog.pageType == "data:blog.isMobile"'>
12.Conditional card for the 404 error page

<b:if cond='data:blog.pageType == "error_page"'>

Types of conditions




Above is the right conditional card, ie, if it is A, then it will happen B. But we also have another type of condition that is negative condition. That is, if not A, then B.

So how are the statements of these two types of conditions different, or is the use of these two types different? The answer is very simple. Notice the == in the types of conditions you specified and! = In the first example you will immediately notice the difference.

Example:

Correct Condition:

<b:if cond='data:blog.pageType == "index"'>
Negative:

<b:if cond='data:blog.pageType != "index"'>
Epilogue:

The above I have taught how to use as well as the condition card that I know. Hopefully, it will help you in optimizing your blog.

0 nhận xét