- Get link
- X
- Other Apps
b:if
The b:if tag, or the if tag, is a tag for specifying a conditional output.
Attributes
cond - Boolean expression for whether the b:if tag's descendants should be rendered.
b:if tags are combined with nested self-closing b:elseif and b:else tags.
b:if tags are combined with nested self-closing b:elseif and b:else tags.
b:elseif
b:elseif tags are self-closing tags used within a b:if tag to separate alternative output for another conditional expression case.
Attributes
cond - Boolean expression for whether the b:elseif tag's subsequent sibling nodes should be rendered.
b:else
b:else tags are self-closing tags used within a b:if tag to separate the default output when the parent b:if tag's condition is false, and none of the other b:elseif conditions are true either.
Example usage
The following example emits a different comment for some possible views.
<b:if cond='data:view.isSearch'>
<!-- Search page -->
<b:elseif value='data:view.isMultipleItems' />
<!-- Other stream page -->
<b:else />
<!-- Not a multiple item page. -->
</b:if>
This would produce an HTML comment with 'Search page' if a search is executed, or a label filter is executed. Other multiple-item pages, like the homepage or a BlogArchive page, would produce 'Other stream page', while the remaining page types would produce 'Not a multiple item page'.