Dynamic meta tags for Blogger with labels as keywords

This is how you can dynamically use Blogger's labels as keywords in your keyword meta tag for each blog post. By using labels as the keywords, you can control meta keywords for each of your blog post pages for search engine optimization purposes. I found this method from www.seocentro.com website.

This is how you can do it.

Replace the <head> code with the codes below:

<!--::::::::::: Block1: Output post meta keywords -->
<b:if cond='data:blog.pageType == &quot;item&quot;'>
   <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 -->
               &lt;meta name=&quot;keywords&quot; content=&quot;<b:loop values='data:post.labels' var='label'><data:label.name/><b:if cond='data:label.isLast != &quot;true&quot;'>,</b:if></b:loop>&quot; /&gt;
<!--::::::::::: Block1 END -->
<head> <!-- THE HEAD -->
<!-- must include(called) here to output other head sub elements -->
<!--::::::::::: Block2: Output Index Title,keywords,decription and Post Title,description -->
<b:include data='blog' name='all-head-content'/>
<!-- Post/Archive Page -->
<b:if cond='data:blog.pageType != &quot;index&quot;'>
    <meta name='description' expr:content='data:blog.pageName' />
<!-- Index Page -->
   <meta name='keywords' content='your,blog,keywords!!' />
   <meta name='description' content='your blog description!!' />
<!--::::::::::: Block2 END -->

Note: There are some limitation to this code. Please check out the original source page that i have listed under my references section below. Make sure you know the limitation before you use it.

References, Sources and Credits:

Popular posts from this blog

How to recalibrate your Samsung Note 4 battery

How to import Tasker projects, profiles, tasks and scenes

How to turn your Windows 7 laptop or dekstop into a WiFi repeater or extender