The b:attr tag, or the attribute tag, is a tag for simplifying adding an attribute to the parent element, especially conditionally.
Attributes
Xem thêm
Attributes
name - Name of the attribute.
value - Value of the attribute.
cond - Boolean expression for whether to append the attribute
Example usage
<div>
<b:attr name='data-foo'
value='data:blog.blogId'
cond='data:view.isHomepage' />
</div>
On homepages, this would produce<div data-foo='123456789012'>
</div>
On other pages, this would produce
<div>
</div>
If get id post use expr:value<b:attr cond='data:view.isMultipleItems' expr:value='data:post.id' name='data-id'/>
Đăng nhận xét