November 15, 2007

Show labels without the post count

Labels are very useful to help categorize your posts, and also so readers can easily find posts they would like to read. The default "labels" widget will also show the post count beside the label name, to inform your readers how many posts are categorized under this label. However, this isn't to everyone's taste, and can also be disheartening when one of your labels only has a small post count beside it! So if you would prefer to remove the post count from your label widgets, here is a quick and easy way to remove it.

How to remove the post count from your label widget

The widget tag for the label post count is contained inside the widget template for the label widget itself. To remove the post count, we simply need to remove this widget tag.

To do this, go to Template>Edit HTML in your Blogger dashboard and ensure you have checked the "expand widget templates" box. Then you will need to locate your labels widget in the template. The easiest way to find it is to use your browser's search function and search for this partial line:

b:widget id='Label
This will easily help you locate your labels widget, even if this was not the first label widget you had installed in your template.

The whole code for the label widget will look something like 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'>
<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>
I've highlighted the tag for the label post count in bold red. All you need to do is delete this line of code from your template (only the red part!) and there will no longer be a post count after each label in your list. You can preview your blog before saving to ensure the widget looks the way you had intended; if all is well, then go ahead and save your template. It really is this simple!

I hope this simple tutorial has been useful to you. I always appreciate your comments and suggestions, so please feel free to leave your comment below.

Advertise on Blogger Buster

Browse through the Archives

All existing posts are still available to view while I'm working on the site, albeit seen in a much simpler interface. Feel free to browse through the archives to find tutorials, templates and articles to help you build a better blog:

Blog Archive

© Blogger Buster 2010 Home | About | Contact | Hire Me | Privacy Policy