Custom View using Blogger Tag

Friday, June 30, 2006

Blogger provided Blogger Template Tag, which is a list of tags used in the template, to provide what you see in the browser.

Now, i will explain a little bit about these tags :

  • <MainPage></MainPage>
  • <ArchivePage></ArchivePage>
  • <ItemPage></ItemPage>
  • <MainOrArchivePage></MainOrArchivePage>
These tags, are defined by Blogger as the Conditional Tags. These tags can give us more flexibility to control what output that we wanted on the Main Page, Archive Page or Item Page.

Main Page is the front page of your blog, in these case, it's the first page to load when you entered some blogspot url,
  • for example: if you entered then the page that loads, and you see is called the Main Page.

Archive Page is the page contains all of your blog's archive (this of course if you have activated archiving). Now the Archive Page is one big chunk of some HTML page that listed all of your posts in the specific period of your archive.
  • For example: this URL is the Archive Page, it usually begins with the year and month of your archive, and ended with archive.html note the bold and italic text ;)

Item Page are the specific page of your posts, each posts you have created are saved by Blogger in one HTML file, which in this case are your Item Page.
  • For example: the URL is somethin' like this , the Item Page is inside a sub folder, beginning with a year then a month then your post page, with unique name depending or your title.
So, what i'm trying to explain here is that you can make some customization of your page, you can have a different view in each page ! For more clear this is some preview of what i've done using conditional tags. (click for larger image)

  • Main Page sample

  • Archive Page sample

  • Item Page sample

Now on the main page, i wanted all the left sidebar to show all of the content, while on the archive page i only wanted to show a search box with selection of recent post and archive, and on the item page, i only wanted to display recent and archive without the search box.

So how do i achive this ? Well, this is where the conditional tags goes in use ^^
For example, notice that the search box appeared in both the Main Page and the Archive Page right ? So in order to make the search box appeared in both page, you have to put it inside the <MainOrArchivePage></MainOrArchivePage> which mean that it'll appear in both Main and Archive Page ^^

If you only wanted somethin appeared only on the Main Page, as in my example the rest of the left sidebar only appear in the Main Page, so put all the rest of your sidebar content inside the tag <MainPage></MainPage> so that it won't appear in the Archive and Item Page.

Now if there is somethin you want to put only on the Archive Page you put it inside the <ArchivePage></ArchivePage> tag.

And as you may figure it out by now, the <ItemPage></ItemPage> tag is used to filter the content you wanted to show only on the Item Page ;)

To put it simple, lemme show you some portion of the code

<!-- This is where i put my search box -->

<h3 class="side-title">Latest Updated Posts</h3>
<div id="latest">
<!-- Latest Updated Post Content -->

<h3 class="side-title">Recent Posts</h3>
<!-- Recent Posts Content -->

<h3 class="side-title">Archives</h3>
<!-- Archives -->
<ul id="blogArchives">
<li><a href="<$BlogItemPermalinkURL$>"><$BlogItemTitle$></a></li>
<br /><br />
<a href="<$BlogURL$>">Back to <$BlogTitle$>'s Main Page</a>
<h3 class="side-title">Friend's Blogs</h3>
<!-- your ads, or somethin goes here -->

<h3 class="side-title">Syndicate</h3>
<!-- your syndicate thing -->
<h3 class="side-title">Select Another Recent Posts</h3>
<li><a href="<$BlogItemPermalinkURL$>"><$BlogPreviousItemTitle$></a></li>

<h3 class="side-title">Select Archives</h3>
<!-- list of archives here -->
<br />
<a href="<$BlogURL$>">Back to <$BlogTitle$>'s Main Page</a>

You may see the variations of conditional tags that i used to control how the view would be ^^ Well you may view source my page to learn it ^^

Last but not least, nothing will come to your knowledge if you don't practice it ;)
So, go and experiment on those tags ^^


Anonymous said...

Hey this was extremely useful! I spent an hour at trying to understand the syntax, and your blog cleared everything up in 5 minutes. Great post.


Efendi said...

hi wng, welcome to zlythern

nice to see you find this post useful :)

but this post right now only applies to the old blogger template ;)

if you need any help for the new blogger tag, shoot me an email anytime ;)

About Me

My Photo
An ordinary, a bit 'geeky' guy, who enjoy blogging about all unique things across the internet world. Blogs about the blogosphere, scripts, fun, games, interesting stuffs, etc. Currently staying and working in Singapore.
View my complete profile