Section 32. Understanding the Blogger Template Language


32. Understanding the Blogger Template Language

BEFORE YOU BEGIN

30 Identifying Elements in the Blogger Template Source


Your blog's main page, archive pages, and individual post pages are all controlled by one master template. For the Blogger application to produce the various and sundry pages that make up your blog, numerous placeholder and container tags are used. This topic provides a very brief overview of the types of Blogger template tags that you might encounter and that you can use to extend your blog; additional information can be found the Blogger Knowledgebase (http://help.blogger.com/bin/topic.py?topic=39). Your basic Blogger template might include only a few of the more important tags or it might include a whole rash of these tags. Although there are definitely some tags you do not want to remove, such as the <Blogger></Blogger> tag pair and most of the post-related tags, other tags are optional and can be added to increase functionality or removed to streamline your template.

NOTE

All Blogger template tags are case sensitive, so pay close attention when editing your template. For instance, if you type <blogger></blogger> instead of <Blogger></Blogger>, your posts will not appear.


Common tags found in your template's HEAD area include the following:

  • <$BlogEncoding$>. This tag produces a content-type declaration matching the language encoding of your blog.

  • <$BlogPageTitle$>. This tag will display the title of your page, and it is found within the HTML <title></title> tag pair.

  • <$BlogMetaData$>. This tag outputs meta information for your blog.

  • <BlogSiteFeed><$BlogSiteFeedUrl$></BlogSiteFeed>. The container tag pair wrapped around the specific site feed URL ensures the proper creation of the <meta> tags that control your site feed.

Tags used within the BODY area, to identify either the blog or the blog author, include

  • <$BlogTitle$>. This tag outputs the title of your blog, stored in your account settings.

  • <$BlogDescription$>. This tag outputs the description of your blog, stored in your account settings.

  • <$BlogOwnerFirstName$>. This tag outputs your first name, stored in your 1account settings.

  • <$BlogOwnerLastName$>. This tag outputs your last name, stored in your account settings.

  • <$BlogOwnerEmail$>. This tag outputs your email address, stored in your account settings.

  • <$BlogOwnerFullName$>. This tag outputs your full name, stored in your account settings.

  • <$BlogOwnerPhotoUrl$>. This tag outputs the URL of your personal image, stored in your account settings.

  • <$BlogOwnerNickname$>. This tag outputs your nickname, stored in your account settings.

  • <$BlogOwnerLocation$>. This tag outputs your city, state, and country, or whatever location you have stored in your account settings.

  • <$BlogOwnerAboutMe$>. This tag outputs the About Me text, stored in your account settings.

  • <$BlogOwnerProfileURL$>. This tag generates a link to your complete Blogger profile.

Tags used to control elements of your posts, found within the BODY area, include

  • <Blogger></Blogger>. This set of container tags holds most other post-related tags and Blogger template functionality.

  • <BlogDateHeader></BlogDateHeader>. This set of tags defines the area in which the date headers are output, as defined in your Formatting settings.

  • <$BlogDateHeaderDate$>. This tag outputs the date of the post.

  • <BlogItemTitle></BlogItemTitle>. This set of tags contains the placeholder tags that display the post title.

  • <BlogItemURL></BlogItemURL>. This set of tags contains the placeholder tags that display the URL of the post.

  • <$BlogItemURL$>. This tag outputs the URL of the post.

  • <$BlogItemTitle$>. This tag outputs the title of the post.

  • <$BlogItemBody$>. This tag outputs the full contents of a blog post.

  • <$BlogItemAuthor$>. This tag outputs the full name of the author of a post, as stored in your account settings.

  • <$BlogItemAuthorNickname$>. This tag outputs the display name of the author of the post, as stored in your account settings.

  • <$BlogItemAuthorEmail$>. This tag outputs the email address of the author of the blog post, as stored in your account settings.

  • <$BlogItemAuthorURL$>. This tag outputs the additional URL of the author of the blog post, as stored in your account settings.

  • <$BlogItemDateTime$>. This tag outputs the date and time attached to the post; this date and time is modifiable at the time of post creation/editing, and might not reflect the actual date and time the post was published.

  • <$BlogItemNumber$>. This tag outputs the unique ID number of the blog post, as determined through the publishing process.

  • <$BlogItemArchiveFileName$>. This tag outputs the archive filename of this post, which may or may not be similar to the permalink URL.

  • <$BlogItemPermalinkURL$>. This tag outputs the permalink URL for this blog post.

  • <$BlogItemControl$>. This tag outputs the Quick Edit link for this post, if Show Quick Editing on Your Blog? is set to Yes in your Basic settings.

  • <BlogDateFooter></BlogDateFooter>. This set of tags defines the area in which the date footers are output, as defined in your Formatting settings.

Tags used to control the comments-related area of your posts include the following:

  • <BlogItemCommentsEnabled></BlogItemCommentsEnabled>. This tag pair surrounds all other comment-related tags, and indicates that this chunk of code should be interpreted only if you have Blogger comments enabled in your Commenting settings.

  • <$BlogItemCommentCount$>. This tag outputs the current number of comments for the particular post.

  • <$BlogItemCommentCreate$>. This tag outputs the URL to the page on which you can read comments and leave comments of your own.

  • <$BlogItemCommentFormOnClick$>. If your Commenting settings warrant it, this tag outputs a link that, when clicked, opens the comments display and forms in a pop-up window rather than a new page.

  • <BlogItemComments></BlogItemComments>. This tag pair surrounds the code that will be output for each comment associated with this post.

  • <$BlogCommentNumber$>. This tag outputs the number of the comment.

  • <$BlogCommentBody$>. This tag outputs the body of the comment left by a reader.

  • <$BlogCommentPermalinkURL$>. This tag outputs a permalink URL to this particular comment.

  • <$BlogCommentAuthor$>. This tag outputs information identifying the author of the comment.

  • <$BlogCommentDateTime$>. This tag outputs the date and time the comment was left by the reader.

  • <$BlogCommentDeleteIcon$>. This tag displays the deletion icon if you are the blog administrator or the person who left the comment.

  • <$BlogItemCreate$>. This tag outputs the link leading to the form to create a new comment.

NOTE

If you are not using Blogger commenting and instead are using a third-party commenting system such as Haloscan, you should remove the Blogger comment-related tags from your template in addition to selecting Hide in your Commenting settings.


Tags used to display elements related to blog archives include the following:

  • <BloggerArchives></BloggerArchives>. This container tag should surround your archive-related tags (shown in the code snippet that follows this list).

  • <$BlogArchiveURL$>. This tag outputs the URL to an archive page.

  • <$BlogArchiveName$>. This tag outputs the name of your archive page, as determined by your Archive Index Date Format setting under Formatting Settings.

A typical implementation of archives will look like the following in your template:

 <BloggerArchives> <a href="<$BlogArchiveURL$>"><$BlogArchiveName$></a> </BloggerArchives>  


For each archived time period, a link containing the URL will surrounded the text version of the time period date. In other words, although this code is only three lines long, it might represent numerous archive links.

The final set of Blogger template tags are called conditional tags because they allow you to display elements based on certain conditions being met. The four sets of conditional tag pairs are

  • <MainPage></MainPage>. Place this tag pair around elements you want to appear only on your blog's main page.

  • <ArchivePage></ArchivePage>. Place this tag pair around elements you want to appear only on archive pages.

  • <ItemPage></ItemPage>. Place this tag pair around elements you want to appear only on individual post pages.

  • <MainOrArchivePage></MainOrArchivePage>. Place this tag pair around elements you want to appear only on your blog's main page and on archive pages.

The prime example of using conditional tags is for elements in your template's sidebar. Perhaps you have a blogroll in your sidebar, but you want it to show only on the main page and not on archive pages or post pages. In that case, you would surround the code for your blogroll like this:

 <MainPage> [code for blogroll] </MainPage> 


You will often see subsets of sidebar information on archive and post pages, with more elements retained for archive pages than individual post pages, simply because archive pages are longer and users might spend just as much time browsing through your archives as they do your main page. Individual post pages are usually quick hits, with the user returning to your main page to continue reading and perusing your site.




Blogging in a Snap
Blogging in a Snap (Sams Teach Yourself)
ISBN: 0672328437
EAN: 2147483647
Year: 2003
Pages: 124

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net