Welcome to the tech blog copacopi

Showing posts with label Blogger template. Show all posts
Showing posts with label Blogger template. Show all posts

How to Make Drop-Down Labels Menu in Blogger?

If you host your blog on the Blogger (blogspot) platform, and you have significant number of labels on your sidebar, you might be looking for a suitable solution to show them, but also save the expensive space for other elements. These two tasks can be achieved by using the option of displaying your labels in a simple drop-down menu. Many bloggers already use drop-down option for long lists of labels (categories), which minimizes clutter and enables information to be displayed in the sidebar neatly.

While Blogger offers a dropdown menu option for the Archives widget, you will not be able to find an option to do the same for your labels. In this post, we will review two ways you can use to convert your regular Label list into a drop-down list.

Method 1

1. Template Backup. As usual, when you just think about making any changes to the template code, it is strongly recommended to make a complete back up of your existing template. This ensures you can easily roll back and restore your current, working template if you make any mistake.

To make a back up of your current template, go to Layout > Edit HTML in your Blogger dashboard and click the “Download Full Template” link near the top of the page. This will offer the option to save your current Blogger template as an XML file to your local computer. Be sure to save this file in a location you can easily find later.

2. Ensure you have a “Labels” widget in your Blogger template. If you do not have a Labels widget activated in your template, go to Layout>Page Elements and add a Labels widget using the “Add a Gadget” link above your sidebar. Definitely, your posts should be labeled as well to transfer the related content to the activated widget.

3. Go to Layout > Edit HTML in your Blogger dashboard. This time, DO NOT check the "Expand Widget Templates" checkbox!

4. Search for the following code (note that the name of the label in your template might be slightly different):
<b:widget id='Label1' locked='false' title='Labels' type='Label'>

5. Replace the above code, with this:
<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<br/>

<select onchange='location=this.options[this.selectedIndex].value;' style='width:200px'>
<option>Labels</option>
<b:loop values='data:labels' var='label'>
<option expr:value='data:label.url'><data:label.name/>
</option>
</b:loop>
</select>

<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>

6. Modifying the Widget. To alter the phrase “Choose a label to view” which is visible when the drop down menu is contracted, you will need to go to the Layout>Edit HTML page of your Blogger dashboard and check the “Expand widget templates” box. Then search for this phrase in your template code. Simply alter the wording of this phrase to something more suitable for your blog, being careful not to alter any of the surrounding code.

To clarify, here is the line of code where adjustments will be made. The text which can be altered is highlighted in red:
<select onchange='location=this.options[this.selectedIndex].value;'>
<option>Choose a Label to View</option>
<b:loop values='data:labels' var='label'>



Method 2
As you understand, the first steps of the code modification will be similar to the method 1, so I will skip the introduction, which you need to backup the template first before doing any modifications.

3. Go to Layout > Edit HTML in your Blogger dashboard. This time, CHECK the "Expand Widget Templates" checkbox!

4. Now look for the following code in your template

<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>

 <ul>
   <b:loop values='data:labels' var='label'>
     <li>
       <b:if cond='data:blog.url == data:label.url'>
         <data:label.name/>
       <b:else/>
         <a expr:href='data:label.url'><data:label.name/></a>
       </b:if>
       (<data:label.count/>)
     </li>
   </b:loop>
   </ul>


<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>

5.
Note that you need to replace only the part of the displayed code IN BLUE. All the remaining text is provided for easy reference. So, replace the text IN BLUE with the text IN RED below:

<br />
<select onchange='location=this.options[this.selectedIndex].value;'>
<option>Select a label</option>
<b:loop values='data:labels' var='label'>
   <option expr:value='data:label.url'><data:label.name/>
      (<data:label.count/>)
   </option>
</b:loop>
</select>


No matter, which method you choose, at the end of the performed modification save the template and back it up with a new name. Do not overwrite the backup file you created at the beginning, since you want to try the option for some time and decide you do not see any problems or performance drawbacks.


Sources and Additional Information:
Read More

Related Posts Widget for Blogger Blog

If you are using the standard blogger approach, your posts are structured through time related logical way. You post new publications, and they appear in the blog history widget. Only for the explicit cases, when your reader is stunned and mesmerized by the publication he came to see through the referral site or search engine, he will dig more, exploring other publications on your blog. Other than that, he will go further, in the best case, leaving a comment. How can you keep him longer? How can you present other beautiful posts, he might find interesting? In one of the previous posts Rotating Post Widget for Blogger Blog I have already presented a way to show something extra to the reader. However, while doing what it is supposed to do, the presented widget does not show the particular articles that are relevant to the blog post your reader came to see. Therefore, embedding the Relevant Articles Widget for Blogger might represent a better solution.


The relevance of the posts is based on the tags or labels, assigned to each of the posts on your blog.

The Widget can be embedded in 9 steps:
1. Go to Layout >Edit HTML in your Blogger Dashboard.

2. Back up your existing Template before making any changes! Export your template to the safe, easy identifiable location.

3. Check the "Expand Widget Templates" box.

4. Search for the </head> tag.

5. Add the following code just before the </head> tag.

<style>
#related-posts {
float : left;
width : 540px;
margin-top:20px;
margin-left : 5px;
margin-bottom:20px;
font : 11px Verdana;
margin-bottom:10px;
}
#related-posts .widget {
list-style-type : none;
margin : 5px 0 5px 0;
padding : 0;
}
#related-posts .widget h2, #related-posts h2 {
color : #940f04;
font-size : 20px;
font-weight : normal;
margin : 5px 7px 0;
padding : 0 0 5px;
}
#related-posts a {
color : #054474;
font-size : 11px;
text-decoration : none;
}
#related-posts a:hover {
color : #054474;
text-decoration : none;
}
#related-posts ul {
border : medium none;
margin : 10px;
padding : 0;
}
#related-posts ul li {
display : block;
background : url("http://i299.photobucket.com/albums/mm297/zozuglogger/weed-bullet.gif") no-repeat 0 0;
margin : 0;
padding-top : 0;
padding-right : 0;
padding-bottom : 1px;
padding-left : 16px;
margin-bottom : 5px;
line-height : 2em;
border-bottom:1px dotted #cccccc;
}
</style>
<script src='http://torrentmoon.com/javascripts/Related_posts_hack.js' type='text/javascript'/>

6. Now search for <p><data:post.body/></p>

7. Add the following code just beneath the code you just searched for.

<b:if cond='data:blog.pageType == "item"'>
<div id="related-posts">
<font face='Arial' size='3'><b>Related Posts : </b></font><font color='#FFFFFF'><b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='data:label.isLast != "true"'>,</b:if><b:if cond='data:blog.pageType == "item"'>
<script expr:src='"/feeds/posts/default/-/" + data:label.name + "?alt=json-in-script&callback=related_results_labels&max-results=5"' type='text/javascript'/></b:if></b:loop> </font>
<script type='text/javascript'> removeRelatedDuplicates(); printRelatedLabels();
</script>
</div></b:if>

8. The default number of the posts is 5 in the code, but at this step you can modify it as per your needs, changing the number in the following line: max-results=5

9. Now Save your Template and you're done!

The credit for the gadget development goes to the Widgets4Free blog.
Read More

Rotating Post Widget for Blogger Blog

In blogger best intentions is keeping the visitor as long as possible, keeping him busy with all the wonderful content you have. But, in many cases, due to the time-related blog building logics, your visitor is leaving the site, without even knowing how much interesting stuff he failed to read beside.

Many different widgets are trying to fill the gap, and random post widget for Blogger is one of them. If you have a blog with more than 20 posts than this gadget is just the thing you might be interesting in.

 

Main features:

1. Shows one post title at a time.

2. Links to the post.

3. Shows post excerpt also.

4. Every 5 seconds shows a new post.

5. Cycles through all the posts in the blog.

6. Starts a new cycle at the end of the list.

7. Once loaded continues cycling even when not connected to the Internet.

8. Uses official Google AJAX technology.

9. Can be used on other blogging platforms (not tested).

10. Hovering with mouse cursor over the post title halts the rotation till mouse moves off the gadget.

 

Drawback:

Posts are not random, the sequence is quite defined - from the newer to the older posts.


Code:

Get code from the developer’s post http://www.blogdoctor.me/2009/01/random-rotating-post-gadget-with.html. If you need to modify the widget as per your particular needs, review the questions and answers below the post. I removed the author’s name and date, for example, decreased dimensions and fonts in half, and placed it in the side column. You can review the Random Post widget modified in the right sidebar.

 

Note that there are three areas you need to put particular data from your blog to make it work. Change "MYBLOG" to actual blog sub-domain and "BLOG_TITLE" to actual title of your blog. Then paste the modified code in the Html gadget and save the gadget. Get your AJAX API key and put it in above code instead of 'PUT_AJAX_KEY_HERE'.

Installation:

1. Login at Blogger.com.
2. Click Layouts link on Dashboard.
3. Click Add Gadget link in sidebar on Page Elements subtab of Layout tab.
4. In popup window scroll down and click Html/Javascript gadget.
5. In Contents window copy the code below and paste after modifying it.

6. Move the new widget blog to the desirable location on your template.

Read More

Using Favicon for your Blog or Website (Part 3)

Using Favicons on Blogger Blog

Favicons activation for the blogger using Blogger platform is easy as well. However, the old method of getting a custom Favicon to display in a Blogger blog no longer works, as of October 2008. If you had your Favicons before that, and they suddenly disappeared, you will just have to reinsert the code in a different area of your Blogger template. If you never had them before, the following instructions will work for you.

The process will take two simple steps, taking that you already found or created your Favicon (review earlier publication).

Step 1: Upload your Favicon file to the Host


Any free images hosting will work for you, if it answers two major questions: reliability and support for ICO format. The easiest way for the Blogger users is taking advantage of the Google Page Creator. You just need to copy the ICO file to a host server so you can link to it.

Go to Google Page Creator and login using your Google account details (use the same details you use for Blogger login). The first time you login to Page Creator you will be given the option of creating a site based on your Gmail address. You might not worry about the look of your new website, as for now you are using it just for your Favicon icons secure storage. When icon has been uploaded, record its web address, as you will need it at the step 2.

Step 2: Add the Favicon HTML to your Blogger site


Go into the Blogger Layout Editor and choose the "Edit HTML" option. As always, before doing any modifications to your template, make sure to save a backup copy to a secure location at your hard drive.

Insert the following code between the]]></b:skin>and </head> tags in your Blogger template:

<link href=’http://YOUR_GMAIL_ADDRESS.googlepages.com/YOUR_ICO_FILENAME.ico’ rel=’shortcut icon’ type=’image/x-icon’/>

Don’t forget to change the URL so it points to the .ico file on your Google Page Creator site (code elements highlighted in red font). Now save your template and view your blog. If your new Favicon doesn’t show up straight away you may need to clear your browser cache.

Note, that the Favicons might not be visible on some browsers. For example, browser I use most often, Maxthon (IE-driver based), did not show them right away. While other browsers, I tried, showed them instantly: Firefox, Chrome, and Flock. Yes, if you use Internet Explorer, the Favicon will not appear unless you have bookmarked your blog and refreshed your browser.

Additional Information:
http://www.thebeginnersbloggingguide.com/2008/05/how-to-add-favicon-to-your-blogger-blog.html
http://www.bloggerbuster.com/2008/04/favicons-made-easy.html
http://www.bloggertipsandtricks.com/2008/10/fix-for-missing-favicon.html
Read More

Free Tool to submit your pages to Social Bookmarking sites

Submitting your pages to Social Bookmarking Sites provides multiple opportunities for your content exposure without violating any rules, creating similar publication, and with minimum time and efforts spent. The offer presentation will show you a way to make the process easier for your visitors to submit your site automatically to major social bookmarking site. That might give you an enormous boost in terms of site exposure and related AdSense income.

1. About BlogSocializer

BlogSocializer is a simple widget for your Blogger based blog. It enables blog readers or visitors to submit your blog to major social bookmarking sites, including Digg, Technorati, Delicious, Yahoo! MyWeb, Google Fusion, Blink, Furl, and Simpy.

2. Copy the code
First just copy the widget code below. (right click, than Copy)

<!-- Start of BlogSocializer Widgets -->
<script language="JavaScript" type="text/javascript">
<!--
var addtoMethod=1;
var AddURL = document.location.href;
var AddTitle = escape(document.title);
-->
</script>
<script language="JavaScript" src="http://blogsocializer.googlepages.com/blogsocializer.js" type="text/javascript"></script>
<!--
Get this Blogger widget at
http://fariezweb.blogspot.com/
and
http://blogsocializer.googlepages.com/
-->
<span style="cursor:pointer;" title="Add to Technorati" onclick="addto(8)"><img src="http://blogsocializer.googlepages.com/technorati.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Delicious" onclick="addto(2)"><img src="http://blogsocializer.googlepages.com/delicious.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Google Fusion" onclick="addto(5)"><img src="http://blogsocializer.googlepages.com/google.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Digg" onclick="addto(3)"><img src="http://blogsocializer.googlepages.com/digg.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Yahoo! MyWeb" onclick="addto(7)"><img src="http://blogsocializer.googlepages.com/yahoo.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Blink" onclick="addto(1)"><img src="http://blogsocializer.googlepages.com/blink.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Furl" onclick="addto(4)"><img src="http://blogsocializer.googlepages.com/furl.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Simpy" onclick="addto(6)"><img src="http://blogsocializer.googlepages.com/simpy.gif" border="0"/></span>
<span style="cursor:pointer;" title="Add to Stumbleupon" onclick="addto(9)"><img src="http://blogsocializer.googlepages.com/stumble.gif" border="0"/></span>
<br />
<span style="font-family: Trebuchet MS, Tahoma, Arial; font-size:10px;" title="Get this bookmarking widgets for your blogger"><a href="http://blogsocializer.googlepages.com/">[get this widget]</a></span>
<!-- End of BlogSocializer Widgets -->

3. Paste the code
Now paste the code to your Blogger template. Can work either on new or classic template. In New template (.xml mode) you can simply add a new widget in ’edit layout’ area. But for classic template you just need to paste it at ’edit html’ area. Just for tips, you may insert the code below post content area. You can find some templates with this widget ready to use at TheFachia.

Blogger edit template area

4. Save and Test
Now time to test your new widget. Try to submit one page of your blog to Digg or Delicious. And see how simple it works. Or you can test the script now as demo how it works. Submit this page to one of your favorite social bookmarking below.

You can find detailed instructions of adding new widget here: http://www.smartbloggerz.com/2008/04/how-to-add-bookmarker-widgets-in.html

Developers website: http://blogsocializer.googlepages.com/index.htm
Read More

How to Put a Widget on a Specific Page of your Blogger Blog



Widgets are short and handy small computer programs that can add more functionality to any Blog platform. In Blogger, where standard set of features and embedded plugins is rather limited, adding extended capabilities with third-party widget might help to spice up your blog and increase its attractiveness. It can be added as an extra code behind the new Page Elements through the Page Elements subtab of the Template tab.

In brief, to add widget or page elements to your blog login at Blogger.com and click on Layout link on Dashboard. Then click the Add Page Element link in the sidebar.

After adding a Page Element to your blog it can be seen on all your blog pages by default, unless you wrap the widget in conditional tags. In this publication, we will present you the way on how to put selectively widgets on particular blog pages. You really can decide on which pages or a single pagethe widget should appear.

WIDGET ON POST PAGES ONLY

If you want to put the widget only on the post (item) pages then paste this line :

<b:if cond=’data:blog.pageType == "item"’>

immediately after the main includable line of code in the widget :

<b:includable id=’main’ var=’top’>

For this login at Blogger.com and click on Layout link on Dashboard. Then click Edit Html subtab of Template tab. Put a check in the Expand Wdgets Template checkbox at the top of the Template code box and scroll down to the widget code. Lastly in the widget code add a </b:if> before the immediate next </b:includable>. This is how the whole widget code will look like after the change :

<b:widget id=’HTML1’ locked=’false’ title=’’ type=’HTML’>
<b:includable id=’main’>
<b:if cond=’data:blog.pageType == "item"’>

WIDGET CODE

</b:if>
</b:includable>
</b:widget>

This widget will only appear on the Post Pages.

WIDGET ON MAIN PAGE ONLY

If you want the widget to appear only on the Main Page of the blog use the code below :

<b:widget id=’HTML1’ locked=’false’ title=’’ type=’HTML’>
<b:includable id=’main’>
<b:if cond=’data:blog.url == data:blog.homepageUrl’>


WIDGET CODE

</b:if>
</b:includable>
</b:widget>

This widget will appear only on the Main Page.

WIDGET ON SPECIFIC BLOG PAGE

There are some cases in which you may want the widget to appear only on a specific page of your blog. For example, there might be some pages on your blog with heavy traffic where you plan to put some special ads or particular content. Create the widget by pasting the HTML in the new widget. Then modify the code as shown below :

<b:widget id=’HTML1’ locked=’false’ title=’’ type=’HTML’>
<b:includable id=’main’>
<b:if cond=’data:blog.url == "BLOG_PAGE_URL"’>


WIDGET CODE

</b:if>
</b:includable>
</b:widget>


Replace the CAPS : BLOG_PAGE_URL with the permalink of your post.

WIDGET ON SPECIFIC LABEL PAGE

You can specify a widget to appear only on specific label pages. This is useful when you want to represent your labels with icons. For example, you may have posts on books and when the label books are clicked in your blog the sidebar will show a book icon. For such widgets, you can use the following code:

<b:widget id=’HTML1’ locked=’false’ title=’’ type=’HTML’>
<b:includable id=’main’>
<b:if cond=’data:blog.url == "http://BLOG_NAME.blogspot.com/search/label/LABEL_NAME"’>


WIDGET CODE

</b:if>
</b:includable>
</b:widget>


Replace BLOG_NAME and LABEL_NAME with actual.
Source: http://betabloggerfordummies.blogspot.com/2007/12/put-widget-on-specific-page-or-url.html
Read More

How to disable text selection on Blogger blog

In one of the previous publications, we presented a way to disable right click on the page of your Blogger blog to decrease the copyright violations from your readers “borrowing” your content for their own purposes. To go further in your content safeguarding efforts, you can make the next step, disabling text selection on your page entirely.

This hack was created by Dynamicdrive as well in the form of Javascript, and is also applicable to those bloggers who don’t like their content copied by others. If this concern is on top of your priorities list, then Copy the following code and Paste it to your blog template:


<script type="text/javascript">

/***********************************************
* Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

function disableSelection(target){
if (typeof target.onselectstart!="undefined") //IE route
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //Firefox route
target.style.MozUserSelect="none"
else //All other route (ie: Opera)
target.onmousedown=function(){return false} How to disable
target.style.cursor = "default"
}

//Sample usages
//disableSelection(document.body) //Disable text selection on entire body
//disableSelection(document.getElementById("mydiv")) //Disable text selection on element with id="mydiv"

</script>
Read More

© Copacopi, AllRightsReserved.