The b:tag tag is a tag for creating a tag or element which is conditionally the container for its children, or contains a dynamic tag name.

Any child elements of the b:tag element will be evaluated and rendered, regardless of whether the parent element is created. If the parent element is not created, the children will be appended to the b:tag element's parent element instead.


name - Name of the element that will be created, e.g. "div" or "span".
cond - Expression which, when false, causes the container element to be omitted.

Note: Attributes which are present on the b:tag element will be copied onto the resulting/created element, if created, except the attributes used by the b:tag element (name and cond).

Example usage

Conditional tag
The following example emits an anchor tag around the blog title, but only if the current view is not the homepage.
<b:tag name='a'
       cond='data:view.url != data:blog.homepageUrl'
  <data:blog.title />

Dynamic tag names
The following example emits different tags depending on whether the current view is mobile.
<b:tag expr:name='data:view.isMobile ? "select" : "ul"'
       cond='data:view.url != data:blog.homepageUrl'
  <b:loop var='item' values='data:items'>
    <b:tag expr:name='data:view.isMobile ? "option" : "li"'>
      <data:item.name />