Tutorials, tips and tricks about Blogger

27 Jan

How to create a Blogger search

4 Comments | by in Design, Tutorials | 2010

Español Português

The blogs hosted on Blogger have by default an internal search located in the navbar, however, it isn’t possible to customize it or change it in order to make it fit our layout. In the other hand, with HTML and XML we can recreate this internal search and customize it any way we want with CSS stylesheets.

HTML/XML structure

As every search box, it is necessary arrange it as a form with two inputs with the blog’s data to make the search successful. The code is as follows:

<div id='search'>
<form expr:action='data:blog.homepageUrl + &quot;search/&quot;' id='searchform' method='get'>
		<input class='searchtext' id='q' name='q' type='text'/>
		<input class='searchsubmit' type='image' name='submit' src='http://sitio-de-hosting.com/search.gif'/>

The first "input" is the text box in which the user will put his/her query, the second is the submit button, which allows (you guessed it) submit the query in the first "input" to process it. This second "input" comes defined by a image (it may be an icon as well) which is why you only have to put in the address to our image on the src attribute, you can get this address by uploading this image to a free hosting service like Imageshack or Photobucket. That’s the only thing you have to modify in the code above.

This code can be added just before the above code:

Dashboard → Layout → Edit HTML

<div id='sidebar-wrapper'>

to show it on the top of the sidebar, but it works on any other location.

CSS Stylesheets

Starting from the classes and ID’s we can apply styles to the form: a background, borders, text format, padding, etc… with CSS. This is an example:

/* Search.
main-wrapper: form */
#search form {
	border:1px solid #999999;
	margin:0 10px 15px;
/* Text box */
.searchtext {
	padding:2px 5px;
	border:2px solid #BBDAFD;
/* submit button */
.searchsubmit {

And the result is something like this:


This is just an example, but it is ready to use just by modifying the input’s image address, background colors and borders, width and marggins, etc… The CSS code is always located before:


It’s simple and looks great fixing this important part of our blog.


4 Comments, leave a reply · Feed
  1. Yunus Yalçınkaya April 25, 2010

    Picture of the broken link.

  2. mas-dand August 9, 2010

    how do I add Read More on my blog?. I get nice template from http://btemplates.com/2010/blogger-template-vector-art-2/

  3. moolivia October 6, 2010

    Where do we add the code in the HTML Layout?


You must be logged in to post a comment.

Tutorials, tips and tricks about Blogger