
Syntax:
<b:tag cond='CONDITION' name='TAG_NAME'>
<!-- Content Goes Here -->
<b:tag>
Characteristics:
- The <b:tag> tag works in all of the XML, except in the tag <b:skin>.
- Several tags <b:tag> can be combined.
- Tags <b:tag> can nest.
Attributes Used for this tag:
Attributes | Classification | Prefix "expr:" | Description | Strictness |
---|---|---|---|---|
name | HTML classic | authorized | The expected value is the name of the tag. Accompanied by the prefix expr:, the value may be:
| Mandatory |
cond | XML Blogger Expression | authorized | Condition of execution of the tag. The expected value must be boolean ( true or false). It can be an explicit value, a data item or a Blogger expression. | Optional |
Some Example Usage:
To add simple tag:
<b:tag name='section'>
</b:tag>
HTML Render:
<section>
</section>
Add Tag by Validating a condition:
<b:tag cond='data:view.isHomepage' name='section'>
</b:tag>
HTML Render:
The new tag section will be added to the HTML rendering only if the current page is the home page.<section>
</section>
Use of Ternary Operator:
<b:tag expr:name='data:view.isHomepage ? "section" : "div"'>
</b:tag>
The new tag will be section if the current page is home. Otherwise, the new tag will be div in the HTML rendering.
Result If True
<section>
</section>
Result if False
<div>
</div>
Add tag with attributes:
<b:tag name='section' class='header'>
</b:tag>
HTML Render:
<section class='header'>
</section>
Conclusion:
The attribute name can conflict, when the tag to generate must also contain an attribute name. To avoid the error, move the attribute name into an attribute tag ( b:attr ).<b:tag name='div'>
<b:attr name='name' value='section'/>
</b:tag>
HTML Render:
In HTML rendering, the attribute name is integrated into the tag.<div name='section'>
</div>
That's all about b:attr Tag in Blogger Tags References.
Post a comment
Was this article useful? Please Leave Your Feedback by writing what's in your mind, below.