JSFiddle - React, Tailwind, and code Playground
HTML
<!--Ésto no estará en el post-->
<a href=http://github.com>GitHub</a>
<a href=http://jsfiddle.net>JSFIDDLE</a>
<!--Ésto es el post-->
<article>
<!--Imagen-->
<a href=http://24.media.tumblr.com/avatar_df0393640054_64.png>imagen</a>
<a href=http://jsfiddle.net>JSFIDDLE</a>
<a href=http://css-tricks.com>CSS-Tricks</a>
<a href=http://www.google.com>Google</a>
<a href=http://emiliocoboscmc.blogspot.com>Emilio cobos</a>
<a href=http://vagabundia.blogspot.com>Vagabundia</a>
<a href=//seoparatorpes.blogspot.com>SEO</a>
</article>
<!--Ésto no-->
<a href=//olobloblogger.com>Oloblogger</a>
<!--Otro post-->
<article>
<a href=//oloblogger.com>Oloblogger</a>
<a href=//www.compartidisimo.com>Compartidisimo</a>
</article>
CSS
/*
Orig via http://jsfiddle.net/csswizardry/yqdFe/
*/
/*
Basado en http://css-tricks.com/favicons-next-to-external-links/
*/
a { display: block; text-decoration: none; padding: 5px; }
article {border: 1px solid #ccc; padding: 20px;}
JavaScript
(function(){
function getDomain(url) {
return url.match(/:\/\/(.[^\/\?]+)/)[1];
}
function forEach( collection, fn ){
for (var i = 0, len = collection.length; i < len ; i++){
fn.call( null, collection[i], i)
}
}
function externalFavicon(){
var posts = document.getElementsByTagName('article'),
links = [],
notInThisHost = new RegExp(window.location.hostname),
href;
forEach(posts,function(post){
// Concatenar sin transformar en array
Array.prototype.push.apply(links,post.getElementsByTagName('a') )
})
forEach(links, function(link){
href = link.href;
// Comprobamos que es un link externo (si empieza por http y no está en este dominio), y si no es una imagen
if( /^(http|\/\/)/.test(href) && ! notInThisHost.test(href) && ! /\.(jpe?g|png|gif)/i.test(href) && (link.firstChild && link.firstChild.tagName !== "IMG" )){
// Usamos el favicon como fondo y añadimos un padding para visibilidad
link.style.background = "url(http://" + getDomain(href) + "/favicon.ico) no-repeat 1px center"
link.style.paddingLeft = "18px"
link.style.backgroundSize = "16px"
}
})
}
// Ejecutamos la función tras terminar la carga de la página para que no consuma recursos innecesarios durante la carga
window.addEventListener ? window.addEventListener('load',externalFavicon,false): window.attachEvent('onload',externalFavicon)
})()