Highlighting words for SEO, turning them off for the users
You might notice in the right side bar I have two options under the settings tab "Un-Bold" and "Re-Bold".
If you try them out you will see what the options do. Basically unbolding any STRONG or BOLD tags or re-bolding them again.
The reason is simple. Bolding important words either in STRONG or BOLD tags is good for SEO. Having content in H1 - H6 tags are even better and so are links - especially if they go to relevant and related content.
However, I don't claim to be the first person to start bolding important keywords and long tail sentences for SEO purposes but I was one of the first to catch on that the benefits for SEO were great.
To much bolding and it looks like spam, too little you might not get much benefit but you have to 2 areas to cater for.
1. The SERP crawlers (Googlebot, BingBot, Yandex etc etc) who see the original source code on the page. When they do they will just see words wrapped in normal STRONG and BOLD tags (See for yourself).
2. However if a user doesn't like the format and mix of bolded and non bolded wording then they can use the settings to add a class to all STRONG and BOLD tags that basically takes aways the font-weight of the element. You would only see this in the generated source code. Running the "Re-Bold" function after the first "Un-Bold" will just remove the class that took away the font-weight in the first place returning the element to it's normal bolded state.
Therefore the code is aimed for both BOTS and users and you can see a simple test page on my main site here: example to unbold and rebold with jQuery.
I have used jQuery for this only because it was simple to write however it wouldn't be too hard to rewrite with plain old JavaScript.
Another extension I have lost since updating this blog format but would be easy to add is the use of a JavaScript created cookie to store the users last preference so that they don't have to keep clicking the "un-bold" option when they visit the site.
As Blogger won't let you add server side code to the blog you will need to do it all with JavaScript but with the new blogger layout (which I love by the way - unlike Google+) it is easy to add JavaScript (external and internal) plus CSS sections and link blocks to control the actions of your functions.
An example of the code is below and hopefully you can see how easy it is to use.
First I load in the latest version of jQuery from Google.
Then I use selectors to ensure I am only targeting the main content part of the page before I add or remove classes to STRONG or BOLD tags.
First I load in the latest version of jQuery from Google.
Then I use selectors to ensure I am only targeting the main content part of the page before I add or remove classes to STRONG or BOLD tags.
<style type="text/css">
.unbold{
font-weight:normal;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
function unbold()
{
$(".entry-content").each(function(){
$("strong",this).addClass("unbold");
$("b",this).addClass("unbold");
});
}
function bold()
{
$(".entry-content").each(function(){
$("strong",this).removeClass("unbold");
$("b",this).removeClass("unbold");
});
}
</script>
So not only are you benefiting from SEO tweaks but you are letting your users turn it off if they feel it's a bit too much. Hey Presto!
No comments:
Post a Comment