The <b:include> is statement takes all the text/code/markup that exists in the <b:includable> tags and copies it into the part that calling the include statement.

Blogger Inclusion tag Syntax and Attribute

<b:include/>
<b:include cond='EXPRESSION'
           data='DATA-ALIAS'
           name='STRING1'/>

<b:includable>
<b:includable id='STRING1'
              var='STRING'>
   <!-- span Block -->
</b:includable>

  • The tags <b:includable> can only nest in a tag <b:widget> or <b:defaultmarkup>.
  • Tags <b:include/> is statement to calling or to include or to take <b:includable> together, and its singleton.
  • 'DATA-ALIAS' is dataset forwarded to be processed inside tag <b:includable>.
  • Attribute name in <b:include> tag, is a statement that he calls <b:includable> to include content together which id same as name.
  • var in <b:includable> tag its data: name to be used by child <data:.../> as children.

<b:include/> and <b:includable> Example

The Includable
<b:includable id='list'>
        <b:loop values='data:foo' var='item'>
        <li>
            <data:item/>
        </li>
        </b:loop>
</b:includable>
Calling Includable 'list' with Data-Alias
<ol>
<b:include data='{ foo: ["Qux","Quux"] }' name='list'/>
<b:include data='{ foo: ["Corge","Graul"] }' name='list'/>
<b:include data='{ foo: ["Garply","Waldo"] }' name='list'/>
</ol>
Result
    1. Qux
    2. Quux
    3. Corge
    4. Graul
    5. Garply
    6. Waldo

With data-alias we can process multiple data with same format and get same result to avoid repeating typing same code again. The data with foo will be forwarded to <b:includable> tag and processed in <b:loop> tag with variable name item transform into <data:item/>.

The Includable With Child
<b:includable id='list' var='parent'>
    <b:include data='parent' name='list2'/>
</b:includable>
<b:includable id='list2'>
<b:if cond='data:foo'>
        <b:loop values='data:foo' var='item'>
        <li>
            <data:item/>
        </li>
        </b:loop>
<b:elseif cond='data:bar'/>
        <ol>
        <b:loop values='data:bar' var='item'>
            <li><data:item/></li>
        </b:loop>
        </ol>
</b:if>
</b:includable>
Calling Includable 'list' with different data name
<ol>
<b:include data='{ foo: ["Qux","Quux"] }' name='list'/>
<b:include data='{ bar: ["Corge","Graul"] }' name='list'/>
<b:include data='{ foo: ["Garply","Waldo"] }' name='list'/>
</ol>
Result
    1. Qux
    2. Quux
        1. Corge
        2. Graul
    3. Garply
    4. Waldo

In this example, data with different name and various string forwarded to <b:includable> with a name 'list' and variable 'parent', transform into group data:parent and gave to next <b:includable> with the name 'list2'. Conditional Statement is there to test which group and process with matching statement.

Server Managed Inclusion

Blogger has default inclusion that we can call to be used in our template. This are inclusions that are stored on the Blogger serverside. Mostly marked with prefix super in the inclusion. Other are The Common Inclusion, this inclusion can be installed anywhere except b:skin. The known inclusion present inside default tempate are:
  • <b:include name='all-head-content'/>
  • <b:include name='postMetadataJSON'/>


Other Tag

Share This

About
BloggerBasics101 is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
Misc
Course