Meta
keywords are very important to do better SEO for your blog.. And you should know
that Search engines look for different description and keywords for each
page of your site. If you put the same thing across all pages of your
site, search engines may regard this as spam.
I saw lots of examples on how to add meta title/description based on the post title for Blogger/Blogspot. but I couldn't find one for using labels/Tags as meta keywords for each post.
After searching I found [Changing the Blogger Title Tag] which describes how to use the post title as the header. although now that could be done by less code like this
So instead of using "data:blog.pageTitle" you use "data:blog.pageName" for post & archive pages. Otherwise, for pages like index/label pages "data:blog.pageTitle" will do the job.
But as far as I see at the very brief Blogger documentation. This is the only way to use labels as meta keywords..
Enough talking.. Here is the code to do it.. which you should place instead of the Head tag..!
The Code is commented and it also outputs the Title and Meta Description tags(using Post title) for your convenience..
Some Issues you should be aware of ):
1- XHTML validation will give your warnings about these issues :
As you can see that's why I'm separating the code into 2 blocks:
first one outside the Head tag to output Post Meta keywrds.
Second one inside the Head Tag to output Title and meta description of all pages and meta keywords for index page; without the need of a widget. And in case an engine didn't like those meta keywords, you still have the title and description where they should be.
3- After Adding that code , you will get errors when trying to do anything in the 'Page elements' and clicking save. the Only solution is cut Block1 from the template & save, do what you need in 'page elements' & save. paste Block1 back in the template.
It is the only way, until Blogspot pay attention to the issue!
To edit your Blogspot template
Update #1
I've adjusted the code to show a title in archive page that is different than index page title. as requested by Silver Bullet.
Update #2
I corrected the code to show different title in label pages. It's considered as an 'index' page but it has a different title. So, we should give it a different title! thanks to GunGz
I saw lots of examples on how to add meta title/description based on the post title for Blogger/Blogspot. but I couldn't find one for using labels/Tags as meta keywords for each post.
After searching I found [Changing the Blogger Title Tag] which describes how to use the post title as the header. although now that could be done by less code like this
<!-- Post/Archive Page -->
<b:if
cond='data:blog.pageType !=
"index"'>
<title><data:blog.pageName/></title>
<!-- Index Page -->
<b:else/>
<title><data:blog.pageTitle/></title>
</b:if>
So instead of using "data:blog.pageTitle" you use "data:blog.pageName" for post & archive pages. Otherwise, for pages like index/label pages "data:blog.pageTitle" will do the job.
But as far as I see at the very brief Blogger documentation. This is the only way to use labels as meta keywords..
Enough talking.. Here is the code to do it.. which you should place instead of the Head tag..!
The Code is commented and it also outputs the Title and Meta Description tags(using Post title) for your convenience..
<!--::::::::::: Block1: Output post meta
keywords -->
<b:if cond='data:blog.pageType == "item"'>
<b:section id='meta1' showaddelement='no'>
<!-- widget must be a of Type = 'blog' to have posts data exposed, and must have a unique id
-->
<!-- Empty Includables(functions) to output
nothing, You must keep them ): -->
<b:widget
id='Blog2' locked='no' type='Blog'>
<b:includable id='nextprev'/>
<b:includable id='backlinks' var='post'/>
<b:includable id='post' var='post'
/>
<b:includable id='status-message'/>
<b:includable
id='comment-form' var='post'/>
<b:includable id='backlinkDeleteIcon' var='backlink'/>
<b:includable id='postQuickEdit' var='post'/>
<b:includable id='commentDeleteIcon' var='comment'/>
<b:includable id='feedLinks'/>
<b:includable id='feedLinksBody' var='links'/>
<b:includable id='comments' var='post'/>
<b:includable id='main' var='top'><!-- Main
Function of Any widget comes with ID 'main'
-->
<!-- Loop Page Posts (only 1 in a post
page )-->
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.labels'>
<!-- If the
post has labels, make Meta keywords by looping lables
-->
<meta name="keywords"
content="<b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='data:label.isLast != "true"'>,</b:if></b:loop>"
/>
</b:if>
</b:loop>
</b:includable>
</b:widget>
</b:section>
</b:if>
<!--::::::::::: Block1 END
-->
<head> <!-- THE HEAD
-->
<!-- must include(called) here to output other
head sub elements -->
<b:include data='blog' name='all-head-content'/>
<!--::::::::::: Block2: Output Index Title,keywords,decription and
Post Title,description -->
<!-- Post/Archive Page
-->
<b:if cond='data:blog.pageType !=
"index"'>
<title><data:blog.pageName/></title>
<meta name='description' expr:content='data:blog.pageName' />
<!-- Index Page
-->
<b:else/>
<title><data:blog.pageTitle/></title>
<meta name='keywords' content='your,blog,keywords!!'
/>
<meta name='description'
content='your blog description!!' />
</b:if>
<!--::::::::::: Block2 END
-->
Some Issues you should be aware of ):
1- XHTML validation will give your warnings about these issues :
- Meta Keywords tag Appears before the Head tag.
Why we have to put that code before the head tag? you have to ask ):
well.. You can't place a widget outside of a section, you can't place a section inside head tag. and Post lables must be called inside of 'Blog' widget. - Meta Keywords will be surrounded with Div tags which should not appear
there.
why? Cause Widget and sections Tags are auto. converted to div tags by Blogger..!
As you can see that's why I'm separating the code into 2 blocks:
first one outside the Head tag to output Post Meta keywrds.
Second one inside the Head Tag to output Title and meta description of all pages and meta keywords for index page; without the need of a widget. And in case an engine didn't like those meta keywords, you still have the title and description where they should be.
3- After Adding that code , you will get errors when trying to do anything in the 'Page elements' and clicking save. the Only solution is cut Block1 from the template & save, do what you need in 'page elements' & save. paste Block1 back in the template.
It is the only way, until Blogspot pay attention to the issue!
To edit your Blogspot template
- Go to Layout > Edit HTML > Check 'Expand Widget Templates', and don't forget to save a backup before you do anything..
- Don't forget to remove those comments.
- Replace those Static Blog meta tags content with real
ones.
Update #1
I've adjusted the code to show a title in archive page that is different than index page title. as requested by Silver Bullet.
Update #2
I corrected the code to show different title in label pages. It's considered as an 'index' page but it has a different title. So, we should give it a different title! thanks to GunGz
Nice post... but have u tested it...
ReplyDeletehttp://berlstone.blogspot.com"
http://bikinisheaven.blogspot.com
ReplyDeletehttp://buttsdiary.blogspot.com
http://hotgirlzfolio.blogspot.com
It looks this post can really do some better SEO.i have tried it now waiting for the results.have you tried it.thanx for this hack,i hope it work..coz i really waiting for a lot of visitors....
ReplyDeleteya nice ha i will try this to my blogTamil Movies Online
ReplyDeletenice post ... but really confused to add in my blog www.wiseguru.co.in
ReplyDeleteHi! Τhiѕ іs my fіrst ѵіsit to yоur blog!
ReplyDeleteWe аrе a team of volunteегs and ѕtarting a nеω іnitiative in а сοmmunitу in the samе niche.
Yοur blοg prονided us valuаblе information to worκ
on. You have dοne a mаrvellous јob!
Also see my website > aide zulutrade
I'm gone to inform my little brother, that he should also visit this website on regular basis to get updated from most up-to-date gossip.
ReplyDeleteFeel free to surf my website - samsung galaxy note 2
full version latest softwares
ReplyDeletesamimomin.blogspot.com
its working on
ReplyDeletehttp://olatricks.blogspot.com/