RC - Aviones - Flying - Models

jueves, 3 de mayo de 2007

Tag Cloud Widget for Blogspot

Translate to English

Translation by WorldLingo
He appeared the programmer :)
I wanted to add to my Blog, a Tag Cloud, to facilitate the task to the Search Engine, from step them comment, so that Google maintained in its index one week to me, soon the site had not been excluded.

I found blog where they explain the code of a Widget for Blogspot, it seemed very good to Me but it needed a spiral return for which I tried.
http://phy3blog.googlepages.com/Beta-Blogger-Label-Cloud.html
http://phydeaux3.blogspot.com/2006/09/code-for-beta-blogger-label-cloud.html

In this Widget for Blogspot, the greater problem than I found, is that it is done in Javascript, this prevents to the Search Engine to index the rest of post/links. In addition when putting in the Widget in the Column right in most of layouts, the Search Engine does not arrive, is very down. Another problem is the Link, they are armed with search, and by post it does not seem to have found an interesting return to Me to this subject, with the instructions of the Template. Basically they are three sections:

1. - Custom and Styles
2. - Loop to add links
3. - Set Loop that links with styles at random.

TODO: I have left to slope a next version to add a limit, as much she is for keywords or links

Dentro del Tag: <b:skin><![CDATA[/* …. ]]></b:skin>

#Tags_Cloud{
background-color:#dfead5;
width:436px;
float:left;
position:relative;left:-18px;
top:-13px;
padding:10px;
}

Hay que expandir el contenido de los Widgets, para encontrar..
<!-- posts -->
<div class='blog-posts'>

<b:include data='top' name='status-message'/>

Justo debajo de esa línea implemente el Tag Cloud, así quedó arriba, al principio de los post, y antes de <b:loop values='data:posts' var='post'>

Source:

<b:if cond='data:blog.pageType != "item"'>
<div id='Tags_Cloud'>
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
<a expr:href='data:post.url' expr:id='"TCloud" + data:post.id + data:label.name'><data:label.name/></a>
</b:loop>
</b:if>
</b:loop>
</div>


<script type='text/javascript'>
//Parametrización
var maxFontSize = 22;
var maxColor = [72,150,179];
var minFontSize = 10;
var minColor = [33,69,82];


function rnd(min,max){
num = max - min;
var rand = Math.random() * num;
rand = Math.round(rand);
return parseInt(min) + rand;
}

function setCloudStyle(link){

var color = new Array(3);

for (var i=0;3 > i;i++) {
color[i]=rnd(minColor[i],maxColor[i])
}

link.style.fontSize = rnd(minFontSize,maxFontSize)+'px';
link.style.color = 'rgb(' + color[0] + ',' + color[1] + ',' + color[2] + ')';
link.style.textTransform = 'lowercase';
link.style.lineHeight = '110%';

// el 40% de las veces podría ser Bold
if (rnd(0,9) > 5){
link.style.fontWeight='bold';
}

// el 20% de las veces podría ser Italic
if (rnd(0,9) > 7){
link.style.fontStyle='italic';
}

}

<b:loop values='data:posts' var='post'>
<b:if cond='data:post.labels'>
<b:loop values='data:post.labels' var='label'>
setCloudStyle(document.getElementById("TCloud<data:post.id/><data:label.name/>"));
</b:loop>
</b:if>
</b:loop>
</script>
</b:if>

2 comentarios:

phydeaux3 dijo...

In this Widget for Blogspot, the greater problem than I found, is that it is done in Javascript, this prevents to the Search Engine to index the rest of post/links.

Umm. Look again. Yes the cloud is done with javascript. But it also includes a noscript section that writes out the links so they can be (and are) crawled by search engines.

I'm not sure about the rest of what this version is supposed to do. I assume the translation is a little off. The phrase 'spiral return' doesn't compute with me. But the original cloud does get crawled by search engines via the noscript section. Anyway, good luck with what you are trying to accomplish.

Jorge Boullosa dijo...

It's true, i'nt see section noscript, Tahnk you for your visist :)


 
website stats