v5Tutorial Complete Blogger Tutorials

Blogger <b:widget> Tag

Widgets are small tools or applications that can be added to enhance blogs content.
  • Widgets are used to add feture in a blog.
  • Design and add content in blogs using widgets.
  • Drag-and-drop system available for rearange widgets. 
  • Widgets, also known as gadgets.

HTML b:widget Syntax

Each Blogger b:widget in your template has opening and closing tags.

<b:widget id='CustomSearch1' title='Search' type='CustomSearch'></b:widget>
Note: In your published blog, all <b:widget> tags will be replaced with <div> tags.

Usage of b:widget Tag

Go to Template > Edit HTML.

Blogger Widget: Search

<html>
<head>
<title><data:blog.pageTitle/></title>
<b:skin/>
</head>

<body>
  <b:section id='new'>
    <b:widget id='CustomSearch1' title='Search' type='CustomSearch'></b:widget>
  </b:section>
</body>
</html>
new
Search
Search Box gadget
Best pratcice to add default Blogger widgets from Layout > Add a Gadget.

Control b:widget Tag

Configer Blogger b:widget with attributes.

<b:widget id='CustomSearch1' class='myClass2' locked='false' title='Search' type='CustomSearch' visible='true'></b:widget>

This Blogger b:widget can be removed from layout. It will be visible in blog & it can be styled with CSS Class myClass2.

HTML b:widget Attributes

Attribute Values Description
id name Required. Defines a name for the section
type name Required. Indicates the kind of widget.
class name Optional. Defines CSS style for the section
locked yes
no
Optional. A locked widget cannot be moved or deleted from the Layout tab. Default is "no"
title name Optional. Defines title for the widget. If no title is specified, a default title such as "List1" will be used.
pageType all
archive
main
item
Optional. The widget will display only on the designated pages of your blog. Default is "all"
mobile yes
no
default
Optional. This decides if the widget will be displayed on mobile or not. Only Header, Blog, Profile, PageList, AdSense, Attribution will be displayed on mobile when the mobile attribute is "default"

Related Post

Java Scripts