Saturday, 20 August 2011

How to make a blogspot template : General steps of making blogspot template


Blogger team tried to make their product easier to use and custom for all users with Template Design function. If you want small changes in fonts, background, layout..., this function can help. But if you want more to make your blog look like a professional website? It's time you need to learn structure of blogger template, APIs, javascripts ... to make a custom template. This serie: “How to make a Blogger template” will take you step by step to creating your own. I will try to make it short, simple and easy to understand, hope it helpful for you .
----------------------------------------------------------------------

Chapter 1  Blogger Template Structure

Chapter 2  Template Header

Chapter 3  Template body and API's

Chapter 4  Inside widget - "Includable"

Chapter 5  Blogger data tags 1

Chapter 6  Blogger data tags 2

Chapter 7  How Blogger widget work

Chapter 8  General steps of making a Blogger template

----------------------------------------------------------------------

CHAPTER 8:   GENERAL STEPS OF MAKING A BLOGGER TEMPLATE


This is the last chapter of series 'How to make a blogspot template'. In this chapter, as a blogger user, I want to share my experience in making Simplex's templates: working order, tools, tips. I won't focus on HTML/CSS /Javascript because you can find documents on these issues easily. I do not tends to go further on Blogger template structures/sections/widgets/data tags/API, because they are mentioned in previous chapters.

Unlike other platforms such as Wordpress or Joomla which a template comes with many files, blogger template is in one file xml only .
As we know, Blogger template contain sections. Here is the order of these sections:

  • Header
  • Blogpost
  • Sidebar
  • Footer

All we need to do when making a template:

  • Place sections and widgets in right order. Add/remove sections /widgets
  • Add HTML arround these sections, and use CSS to decorating them.
  • Add javascript/jquery for special effects, get the feeds and mashup homepage.

1, Place sections and widgets in right order

Blogspot is made up with sections, widgets... so you have to place them in right order, add more sections /widget for the function you want and remove unnecessary sections/widgets .
For example, in Simplex Blognews template, I add more sections for page list ( in the top of page ), sections for advertising banner ...remove default sections and widgets in sidebar.
I also use conditional statement <b:if> to hide sections/widget in some specific cases. For example ,we all know blogpost widget show the post list /single post (see chapter on blogpost widget here), but in the homepage, I don't want it to show up, so I use a conditional statement to cover all blogpost widget:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
homepage content
<b:else/>
blogpost widget .....
</b:if>

In the code above, if the current page is homepage, it will show homepage content, if the current page is a category page or single post, it will call blogpost widget for processing content.
Or if we want to hide all the blog content when go to a specific page, we can use a conditional statement like that:

<b:if cond='data:blog.url == &quot;page url&quot;'>
.....
<b:else/>
other content here
</b:if>
By add/remove widgets and place them in right order, we have the frame of a template.

2, Add HTML and CSS around sections/widgets

We have a template's frame with sections and widgets, now we need to add more HTML tags around and decorate these HTML tags with CSS to make it display as we want: images, text, fonts  ....You can do all in this step.
Firebugs is the best tool for this work, you can find the post on how to use this tool here. It will reduce your time on working with CSS and HTML. You can use this tool to inspect elements on websites which has design you love and find out which HTML/CSS their designer used. CSS tags information and cheatsheet can be found in this post.
To get some inspirations, you can go to template galleries, collections, or go to famous blogs on design. Sometimes, combining the elements which you love from different templates can give you an unique design.

3, Add Javascripts/jquery

Because blogger doesn't allow server side programing, Javascript/Jquery give us the solution for mashing up a homepage. By using Javascript to get feeds from categories in blog, split the feed into post titles, post summaries ...and then display them, we have a good homepage, as you see in Simplex' templates.
Javascript/Jquery is also used to make special effects, for example, sliders, hover buttons, menu ...
You can find out more post on using Jquery/Javascript in SimplexDesign blog.

That's all steps I applied when making a template and it works for me. I can't tell you how to make a specific template, because it's very long and take times. I hope with series 'How to make a blogspot template' you can:

  • Understand the basic of a blogspot template, structure,what it contain.
  • Functions of sections /widgets,how they work. Meaning of data tags/Api and statements.
  • General steps to make a template,what we have to do ,what we have to search in google for making an elements ....

By reading all 8 chapters,I hope every time you see the code of Simplex templates, you can understand what I did, and then make your own customization or apply in making your own template.
It take time to search, read and then apply to make a template. It's not easy. But if you want, you can do it. Thanks for your time.

Friday, 5 August 2011

How to make a blogger template : how blogspot widget work?


Blogger team tried to make their product easier to use and custom for all users with Template Design function. If you want small changes in fonts, background, layout..., this function can help. But if you want more to make your blog look like a professional website? It's time you need to learn structure of blogger template, APIs, javascripts ... to make a custom template. This serie: “How to make a Blogger template” will take you step by step to creating your own. I will try to make it short, simple and easy to understand, hope it helpful for you .
----------------------------------------------------------------------

Chapter 1  Blogger Template Structure

Chapter 2  Template Header

Chapter 3  Template body and API's

Chapter 4  Inside widget - "Includable"

Chapter 5  Blogger data tags 1

Chapter 6  Blogger data tags 2

Chapter 7  How Blogger widget work

Chapter 8  General steps of making a Blogger template

----------------------------------------------------------------------

CHAPTER 7:   HOW BLOGGER WIDGET WORKS


In this chapter, we will combine all things from previous chapters to one and see how a widget works.
In a template, Blogpost widget starts with this line:

<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'>
The id can be vary in different template, but type="Blog" is required
In this widget, there are some 'includable's:

  • <b:includable id='main' var='top'>: main includable, this includable will take the main task for processing data and send the result to monitor.
  • <b:includable id='nextprev'>: this includable will add the link 'next page', 'prev pag' at the bottom of homepage ,archive page, and add the link 'next post','previous post' at the bottom of single post .
  • <b:includable id='mobile-nextprev'>: this includable do the same task to nextprev includable above, but this includable will work if you browse the blog in mobile .
  • <b:includable id='post' var='post'>: this includable will process the data of each post, it will show post title, post body, date .... if you are reading a single post ,and show post summary if you are in homepage or archive page
  • <b:includable id='mobile-index-post' var='post'>: like 'post' includable above ,but it work on mobile
  • <b:includable id='postQuickEdit' var='post'>: this includable will add an small pencil at the end of post ,that allow blog owner can edit the post easily ,click on this pencil ,blog owner will be redirected to post editing window ,don't need to back to dashboard ,and search for post which he want to edit from post list.
  • <b:includable id='shareButtons' var='post'>: this includable will show a list of share buttons at the end of post.
  • <b:includable id='comments' var='post'>: show all comments of each post.
  • <b:includable id='commentDeleteIcon' var='comment'>: add a recycle bin symbol next to the comment ,allow blog owner delete unwanted comment.
  • <b:includable id='comment-form' var='post'>: show the comment form bellow the post ,allow reader to write their comment.
  • <b:includable id='backlinks' var='post'>: show the backlinks to a post.
  • <b:includable id='backlinkDeleteIcon' var='backlink'>: show the recycle bin icon next t'o the backlink.
  • <b:includable id='feedLinks'> and <b:includable id='feedLinksBody' var='links'>:show the feed links to blog and to each post.
  • <b:includable id='status-message'>: show the status message, like this ' show all post under label xyz'.

Blogpost work as diagram bellow

 

1, Blogpost widget starts working.

2, It starts a loop statement to loop through all posts.

3, Check value of counting variable “i”. If “i” smaller than the number of posts, call “post” includable for showing post data (post title, post body ,author, labels...).

4a,4b,4c, In the “post” includable, if current page is a single post, it calls other includables such as post edit icon, comment, comment form ... . If current page is homepage or an archive page, these includables will not be called.

5, Go to the next post and back to the check point at step 3.

6, In case of finish looping, back to the main includable.

7, Call “next prev” includable (or feedlinks, backlinks...if necessary), add the link to next and previous post to the end of page.

8, Finish.

In these includables, beside data tags, we can add HTML, javascript to make it display as we want.