v5Tutorial Complete Blogger Tutorials

Blogger <data:name/> Tag

Use it to add specific pieces of data in your template.
  • It can show the particular piece of data you want to use.
  • Different types of widgets use different data.

HTML data:name Syntax

Blogger data:name can be formatted as <data:name/> or <data:name1.name2/>

<data:title/>

It would print out the title of a widget.

Usage of data:name Tag

Go to Template > Edit HTML.

Blogger Section: new

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

<body>
<b:section id='new'>
<b:widget id='HTML1' type='HTML' title="We Love v5 Blogger">
  <b:includable id='main'>
  <data:title/>
  </b:includable>
</b:widget>
</b:section>
</body>
</html>
We Love v5 Blogger
<data:blog.pageTitle/> will print the title of your page.
<data:title/> will print the title of HTML1 widget.

Globally Available Data

This information applies to the entire page, so you can use it anywhere, unlike other data which can only be used in a specific widget. These should be referenced as part of the overall "blog" data, e.g. as <data:blog.title/>, etc.

Name Values Description
title name The blog's title.
pageType item
archive
index
The type of the current page.
url URL The URL of the current page.
homepageUrl URL The homepage of the blog.
pageTitle name The title of the current page. This is often the blog title, but may contain additional information on archive or post pages.
encoding name The encoding to use for the blog, e.g. UTF-8.
languageDirection ltr
rtl
Left-to-right and right-to-left languages, respectively.
feedLinks links The autodiscovery feed links for the page header.

Page Header

This is a simple widget with just two pieces of data. They can be referenced simply as <data:title/> and <data:description/>.

Name Values Description
title name The blog's title.
description name The blog's description.

Blog Posts

This is the central part of any blog, and the most complex. You should definitely consider simply making modifications to one of the default templates before writing a blog posts widget from scratch. But however you want to do it, here's all the data available in this widget.

Name Values Description
feedLinks url
name
feedType
mimeType
A list of feeds for this page. On the main page, this will contain the main blog feeds; on item pages, this will also contain comments feeds.
olderPageUrl URL If there are older posts than the ones on the current page, this is a URL to those posts. Context-sensitive for page type. (Not all pages will have this link.)
olderPageTitle name Title of the link to the older page of posts.
newerPageUrl URL The newer equivalent of olderPageUrl.
newerPageTitle name The newer equivalent of olderPageTitle.
commentLabel name The phrase to use to show the number of comments, e.g. "comments."
authorLabel name The phrase to use to indicate who wrote the post, e.g. "posted by."
timestampLabel name The phrase to use to indicate when the post was written, e.g. "posted at."
postLabelsLabel name Phrase to introduce the list of post labels, e.g. "labels for this post."
posts dateHeader
id
title
body
author
url
timestamp
labels
allowComments
numComments
showBacklinks
numBacklinks
addCommentUrl
emailPostUrl
editUrl
feedLinks
comments
dateHeader: The date of this post, only present if this is the first post in the list that was posted on this day.
id: The numeric post ID.
title: The post's title.
body: The content of the post.
author: The display name of the post author.
url: The permalink of this post.
timestamp: The post's timestamp. Unlike dateHeader, this exists for every post.
labels: The list of the post's labels. Each label contains the following: name: The label text. url: The URL of the page that lists all posts in this blog with this label. isLast: True or false. Whether this label is the last one in the list (useful for placing commas).
allowComments: 'True' if this post allows comments.
numComments: The number of comments on this post.
showBacklinks: Whether to show backlinks for this post.
numBacklinks: Number of backlinks for this post.
addCommentUrl: The URL of the 'add a comment' form for this post.
emailPostUrl: The URL of the 'email this post' form for this post.
editUrl: The URL of the edit form for this post.
feedLinks: A list of feeds specific to this post. (This is different from the overall blog feedLinks, as it may contain a feed for the post's comments, for instance.) Each contains the following: url: The feed URL. name: The feed name (e.g. 'Posts' or 'Comments'). feedType: The type of feed (Atom or RSS). mimeType: The mime type of the feed.
comments: A list of all comments for this post (on item pages only). Each contains the following: id: The numeric ID of the comment. body: The body of the comment. timestamp: The time the comment was created. author: The display name of the comment's author, or 'Anonymous'. authorUrl: URL of the comment author's profile, if the comment is not anonymous. deleteUrl: The URL for deleting this comment. isDeleted: Whether this comment has been deleted. (The text of deleted comments is replaced with a placeholder.)
backlinksLabel name Phrase to describe backlinks to this post, e.g. "links to this post."

Blog Archives

The different styles provided here are for the different default options on the Page Elements tab. If you're designing a new version, it's easiest to use 'FLAT' as the style, and then manipulate the rest of the data as desired.

Name Values Description
title name The title of the widget.
style MENU
FLAT
HIERARCHY
One of 'MENU', 'FLAT', or 'HIERARCHY'.
data name
url
post-count
A list of each archive unit, each of which contains. name: The name of this archive interval, e.g. "August 2006." url: The link to the page containing posts from this interval. post-count: How many posts there are in this interval.

Profile Widget

For a blog with a single author, the profile widget contains the following information. Note that to access different parts of the photo data, you'll use notation such as <data:photo.url/>.

Name Values Description
title name The title of the widget.
userUrl URL The author's profile URL.
location name The location from the author's profile.
aboutme value The "About Me" information from the profile.
displayname name The author's display name.
photo url
width
height
alt
The user's profile photo, made up of the following: url: The photo URL. width: The photo's width, in pixels. height: The photo's height, in pixels. alt: The "alt" text for the photo.

On team blogs, the profile widget contains less information about more authors, as follows.

Name Values Description
title name The title of the widget.
authors displayname
userURL
The list of all authors, each of which contains the following: displayname: The author's display name. userURL: The author's profile URL.
If you want to design your template to handle both single- and multiple-author blogs, you can use the data:team variable to distinguish between the two cases. E.g. <b:if cond='data:team=="true"'> (display multiple authors) </b:if>

Text / HTML / JavaScript Widget

The Text widget and the HTML/JavaScript widget work the same way and have the same two pieces of data.

Name Values Description
title name The widget's title.
content value The content of the widget.

Feed Widget

A feed widget's content is dynamically loaded using Google AJAX API after blog is rendered in a browser. It can be styled only using CSS.

Name Values Description
title name The widget's title.
feedUrl URL The URL of the feed.

Picture Widget

A picture widget contains a single image, and provides all the relevant data for that image.

Name Values Description
title name The title of the widget.
sourceUrl URL The URL of the image.
width number The image's width, in pixels.
height number The image's height, in pixels.
caption name The image caption.

Labels Widget

The labels widget includes a list of all labels that are in use on the blog.

Name Values Description
title name The widget title.
labels name
count
url
The list of labels, each of which contains: name: The text of the label. count: How many posts have this label. url: A link to a page displaying posts with this label.

List Widget

The simplest form of a list. Each item is just a single piece of text, without any different types of data within it.

Name Values Description
title name The widget title.
items name The list of items.

Link List Widget

A slightly fancier list, where each item has two parts to it: the text and the link.

Name Values Description
title name The widget title.
links name
target
The list of links, each of which contains: name: The link's text. target: The link's URL.

Logo Widget

It doesn't get any simpler than this one. Just one piece of data here.

Name Values Description
fullButton URL The URL of the Blogger button you've selected.

Related Post

Java Scripts