Extras

Resources

Template tags

Colors

(X)HTML

CSS

Doctypes

Entities

CGI Scripts

Events

Hexadecimals

Tools

Extra Tips

Blogger Template Tags

Blogger saves your blog entries internally in a database, not in static files. When you hit the Publish Post button, Blogger generates the blog’s Web page by outputting the information from the data base according to the formatting instructions given in your blog’s template, which you originally chose on page 5. The template is made up of a style sheet that contains the formatting instructions, template or placeholder tags that determine which parts of your blog should go in which place on the Web page, and static text and icons that help identify the different parts of your blog.

This is a listing of all of Blogger’s template tags and how you can use them to generate your blog pages. You'll find further instructions for how to use them in the book, particularly in Chapter 4 - Personalizing your blog.

template tags for the head section

The tags described below are all used within the <head> and </head> tags at the top of your blog’s template

<$BlogSiteFeedLink$> generates a link tag on your page that makes browsers like Firefox aware of your site feed and its URL: <link rel="service.feed" type="application/atom+xml" title="Knowing Beans" href="http://knowingbeans.blogspot.com/atom.xml" />
<$BlogEncoding$> outputs the character encoding that you chose in the Encoding field on the Settings | Formatting page
<BlogSiteFeed>...</BlogSiteFeed> a conditional tag whose contents are only output if you’ve selected Yes for Publish Site Feed on the Settings | Site Feed page
<$BlogSiteFeedUrl$> generates the URL for your blog site feed (see page 108); must be within opening and closing <BlogSiteFeed> tags to work properly. Note the lowercase rl.
<$BlogMetaData$> generates an entire section of meta data, including: a line declaring the character encoding, as specified in the Encoding field on the Settings | Formatting page:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
a line telling Microsoft not to convert parts of your page into advertising links toward their site:
<meta name="MSSmartTagsPreventParsing" content="true" /> a line identifying Blogger as the program that created the file:
<meta name="generator" content="Blogger" />
if you have selected No for Add your Blog to our listings (page 106), part of the meta data will be <meta name="ROBOTS" content="NOINDEX,NOFOLLOW" />
if you have selected Yes for Publish Site Feed (page 108), part of the meta data will look something like <link rel="alternate" type="application/atom+xml" title="Knowing Beans" href="atom.xml" />
<$BlogPageTitle$> Most often used within <title> and </title> tags inside the head section of your blog’s template
It is one of Blogger’s conditional or smart tags that varies according to where it appears.If the page being displayed is your main blog page, the title is, for example, Knowing Beans. If the page is an archive page, you’ll get the blog title followed by the date information, something like Knowing Beans - August, 2004. If the page is a post page, you’ll get the title followed by the title of the post, as in Knowing Beans - Lots of reading.

template tags for the profile

The tags described below are used to take information from your profile and display it on your blog page.

<$BlogOwnerFirstName$> outputs the contents of the First Name field (page 61)
<$BlogOwnerLastName$> outputs the contents of the Last Name field (page 61)
<$BlogOwnerEmail$> outputs the contents of the Email Address field (page 61)
<$BlogOwnerFullName$> outputs the contents of the First Name field followed by a space and the contents of the Last Name field
<$BlogOwnerPhotoUrl$> outputs the contents of the Photo URL field (page 62); notice the lowercase rl at the end of the tag
<$BlogOwnerProfileUrl$> outputs the URL of the profile page itself; notice the lowercase rl at the end of the tag
<$BlogOwnerNickname$> outputs the contents of the Display Name field (page 61)
<$BlogOwnerLocation$> outputs the contents of the City/Town field, followed by a space and a comma, the contents of the Region/State field, another space and comma, and the contents of the Country field (page 63). If any of the fields are omitted, the corresponding data, spaces, and commas disappear.
<$BlogOwnerAboutMe$> outputs the contents of the About Me field (page 64)
<$BlogOwnerProfile$> creates an About Me section with About Me as the header, followed by <$BlogOwnerPhotoUrl$> wrapped with the text that follows: the word Name:, followed by either <$BlogOwnerFullName$> or <$BlogOwnerNickname$> (the latter is used if First Name and Last Name are not entered in the profile), followed by the word Location:, followed by <$BlogOwnerLocation$>, followed by <$BlogOwnerAboutMe$>, followed by the words View my complete profile, linked to <$BlogOwnerProfileUrl$>.
If any of the fields are empty, the spacing and titles that would have gone with them are quietly omitted.

template tags for the blog body

The tags described below are used to output the main body of your blog page, including the blog entries themselves.

<$BlogTitle$> outputs the contents of the Title field from the Settings | Basic page (page 38)
<$BlogURL$> outputs the URL of the blog’s main page, e.g., http://knowingbeans.blogspot.com (page 4)
<$BlogDescription$> outputs the contents of the Description field from the Settings | Basic page (page 38)
<Blogger>... </Blogger> anything that should repeat for each entry in your blog must be contained within these tags
<BlogDateHeader>...</BlogDateHeader> a conditional tag whose contents only appear with the first (and only the first) of each day’s blog posts
<$BlogDateHeaderDate$> generates the date of the post; its format is determined by the selection made in the Date Header Format field on the Settings | Format page; must be enclosed in opening and closing <BlogDateHeader> tags;
<BlogDateFooter>... </BlogDateFooter> a conditional tag whose contents only appear with the last (and only the last) of each day’s blog posts
<BlogItemTitle>... </BlogItemTitle> a conditional tag whose contents are output only if the post has a title; should be used to contain the <$BlogItemTitle$>
<$BlogItemTitle$> outputs the title of an individual post; must be contained in opening and closing <BlogItemTitle> tags
<BlogItemURL>...</BlogItemURL> a conditional tag whose contents are output only if the <$BlogItemURL$> is not empty; is useful if there are other formatting instructions that should be hidden when no <$BlogItemURL$> is present
<$BlogItemURL$> outputs the contents of the Link field from the Post | Create page, which contains an external URL to which the post is presumably related
<$BlogItemBody$> outputs the body of the post
<$BlogItemAuthor$> outputs the contents of the First Name and Last Name fields from the profile of the blogger who wrote the post
<$BlogItemAuthorNickname$> outputs the contents of the Display Name field from the profile of the blogger who wrote the post
<$BlogItemAuthorEmail$> outputs the contents of the Email Address field from the profile of the blogger who wrote the post
<$BlogItemAuthorURL$> outputs the contents of the Homepage URL field from the profile of the blogger who wrote the post
<$BlogItemDateTime$> outputs the date and/or time that the post was written; the format, and indeed whether or not the date and/or time are included, is determined by the selection in the Timestamp Format field on the Settings | Formatting page
<$BlogItemNumber$> outputs the post’s unique id number; is useful as the target of a permalink when you’re not using individual post pages
<$BlogItemArchiveFileName$> outputs the archive file name for the individual post
<$BlogItemPermalinkURL$> outputs the URL of an individual post’s permalink; note that this URL will change if you change the setting for Enable Post Pages on the Settings | Archives page
<$BlogItemControl$> creates a QuickEdit link on your blog page that brings you directly to the Posting | Edit Posts page for an individual blog; only appears to the author of the blog post or to the owner of the blog and only if they’re logged into their Blogger account
also creates the Email Post links icon that allows visitors to email your posts to others (see page 111)

conditional template tags

The tags described below only display their contents on certain kinds of pages.

<MainOrArchivePage>...</MainOrArchivePage> encloses items that should only be displayed on the main or archive pages of your blog. In other words, elements contained within these tags will be hidden on post pages.
<MainPage>...</MainPage> encloses items that should only be displayed on the main page; items contained within these tags will be hidden on archive and post pages
<ArchivePage>...</ArchivePage> encloses items that should only be displayed on an archive page; items contained within these tags will be hidden on the main page or on post pages
<ItemPage>...</ItemPage> encloses items that should only be displayed on a post page; items contained within these tags will be hidden on the main page or on archive pages

template tags for previous posts

The tags described below are used to make a listing of previous posts.

<BloggerPreviousItems>...</BloggerPreviousItems> generates the code contained within its tags for each of the 10 previous posts; on the main page, these are the 10 most recent posts; on post pages, these are the 10 posts before the one being displayed
<$BlogPreviousItemTitle$> generates the title of one of the previous posts; must be enclosed in opening and closing <BloggerPreviousItems> tags to work properly; often used with <$BlogItemPermalinkURL$> (described in previous table) to generate a link to the previous post in question.

template tags for comments

The tags described below are used for displaying a post’s comments.

<BlogItemCommentsEnabled>...</BlogItemCommentsEnabled> a conditional tag whose contents are only displayed if a post allows comments (see page 79); should be used to enclose all comment tags
<$BlogItemCommentCount$>generates the number of comments that a post currently has
<BlogItemComments>...</BlogItemComments> generates the code contained within its tags for each of a post’s comments; you may want to enclose this section within <ItemPage> tags (see previous page) so that the comments only appear on post pages, and not on the main page or on archive pages
<$BlogCommentNumber$>generates the unique identifier for a comment; analogous to the <$BlogItemNumber$> tag
<$BlogCommentBody$> generates the body of the comment
<$BlogCommentPermalinkURL$> outputs the URL of an individual comment’s permalink
<$BlogCommentAuthor$> outputs the contents of the Display Name field of the profile of the blogger who wrote the comment; includes a link to that blogger’s profile, if available
<$BlogCommentDateTime$> outputs the date and/or time the comment was posted; depends on the Timestamp Format field on the Settings | Formatting page
<$BlogCommentDeleteIcon$> creates an icon for deleting the comment; only appears if the person viewing the comment is the comment’s author or the blog’s owner
<$BlogItemCreate$> creates a link so that the visitor can post a comment

template tags for archive pages

The tags described below are used to generate lists of archive pages.

<BloggerArchives>...</BloggerArchives> will generate the code it contains for each archive page in the blog
<$BlogArchiveName$> generates the name of each archive page, depending on the option chosen in the Archive Frequency menu on the Settings | Archiving page
<$BlogArchiveURL$> generates the URL of each archive page, and depends on the option chosen in the Archive Frequency menu on the Settings | Archiving page

©Copyright 2005 by Elizabeth Castro. All rights reserved.
Please don't copy this page. Instead, link to it! Thanks.