My previous backlinks hack was a quick fix to allow backlinks on the main page, since I wanted to do that. It was, however, kind of ugly, complicated, and like the ‘normal’ backlinks code broke XML well-formedness. I have, therefore, come up with a new hack that does the exact same thing, but is faster, easier, and XHTML valid. The new steps are below :
- Enable backlinks on your blog — an obvious, but necessary, step
- Put this code in the <head> section of your blog template:
<script type=”text/javascript”>
//<![CDATA[
function toggleitem(postid,linkid,newtxt,displaytype) {
if(!displaytype) {displaytype = ‘block’;}
var whichpost = document.getElementById(postid);
if (whichpost.style.display != “none”) {
whichpost.style.display = “none”;
} else {
whichpost.style.display = displaytype;
}
if(linkid) {
var lnk = document.getElementById(linkid);
lnk.href = “javascript:toggleitem(‘”+postid+”‘,'”+linkid+”‘,'”+lnk.innerHTML+”‘);”;
lnk.innerHTML = newtxt;
}
}
//]]>
</script>
- Find the section in your template that starts with <BlogItemBacklinksEnabled> and ends with </BlogItemBacklinksEnabled> and replace the entire thing (these tags included) with this code:
<BlogItemBacklinksEnabled>
<ItemPage><div style=”display:block;” id=”backlinks”></ItemPage>
<MainOrArchivePage><div style=”display:none;” id=”backlinks<$BlogItemNumber$>”></MainOrArchivePage>
<h4>Backlinks:</h4>
<script type=”text/javascript”>backlink = new Array();BL_Backlinks = new Array();</script>
<script type=”text/javascript” src=”
http://www.blogger.com/dyn-js/backlink.js?blogID;$BlogID$>&postID=<$BlogItemNumber$>”></script>
<script type=”text/javascript”>
//<![CDATA[
for(var i = 0; i < BL_Backlinks.length; i++) {
document.write(‘<dt class=”comment-title”>’);
document.write(‘<span class=”comment-toggler”> </span>’);
document.write(‘<a href=”‘+BL_Backlinks[i][“BlogBacklinkURL”]+'”>’+BL_Backlinks[i][“BlogBacklinkTitle”]+'</a>’);
document.write(‘</dt>’);
document.write(‘<dd class=”comment-body”>’+BL_Backlinks[i][“BlogBacklinkSnippet”]);
document.write(‘<br />’);
document.write(‘<span class=”comment-poster”>’);
document.write(‘<em>posted by ‘+BL_Backlinks[i][“BlogBacklinkAuthor”]+’ @ ‘+BL_Backlinks[i][“BlogBacklinkDateTime”]+'</em>’);
document.write(‘</span>’);
document.write(‘</dd>’);
}//end for
//]]>
</script>
<p class=”comment-timestamp”><a class=”comment-link” href=”javascript:BlogThis();”>Create a Link</a></p>
</div>
</BlogItemBacklinksEnabled>
- Find the code for the ‘links to this post’ link in your post footer template code and replace it with ‘<a href=”<$BlogItemPermalinkUrl$>#backlinks” onclick=”toggleitem(‘backlinks<MainOrArchivePage><$BlogItemNumber$></MainOrArchivePage>’);return false;”>links to this post</a>‘
- Save your template and republish your blog!
http://del.icio.us/singpolyma.techblog/hacks
FeedXS is the proof that RSS is beyond blogging. Where exactly it is, we’re not sure, however. FeedXS allows you to create RSS feeds through an MSN contact. Sign up for an account, add them to your MSN and ‘log in’. After that, everything you say to that contact goes in your feed. I’m not 100% sure how this is useful… or if it is useful. It might be if you could add the contact to a group conversation to keep track of it later, but even then I’m not sure… This is beyond blogging, and I’m sure the because-it’s-cool people will find all sorts of weird and wonderful uses for it… maybe even me 😉
Google Talk has been opened to communicate with other XMPP IM services! One of the complaints against it when it first launched was that it used the open XMPP protocol, but was a closed system. No longer. This is a smart, and a useful, move for them. Hopefully they’ll add MSN/AIM/ICQ integration eventaully as well…
I have finalised the first version of a template hack for Blogger that inlines Commentosphere data for comments on your blog. This allows you to make better use of the semi-threading features of Commentosphere. Insert only the code snippets for the data you want (the first two are invisible and mandatory).
- Insert this code somewhere in the post section of your template (it is invisible, so it doesn’t matter where):
<script type=”text/javascript”>
//<![CDATA[
posturl = ‘<$BlogItemPermalinkUrl$>’;
//]]>
</script>
- Insert this code right after your <BlogItemComments> tag:
<script type=”text/javascript”>
//<![CDATA[
csdata = {};
for(var i=0; i<Commentosphere.posts.length; i++) {
if(Commentosphere.posts[i].url == posturl+’#c<$BlogCommentNumber$>’ || Commentosphere.posts[i].url == posturl+’#<$BlogCommentNumber$>’) {
csdata = Commentosphere.posts[i];
break;
}//end if url == this
}//end for
//]]>
</script>
- Insert this code where you want the links to parents of the comment (if there are any) to show up:
<script type=”text/javascript”>
//<![CDATA[
if(csdata.parents && csdata.parents[0] != ”) {
document.write(‘(‘);
for(var i=0; i<csdata.parents.length; i++) {
if(i > 0)
document.write(‘ | ‘);
parenturl = ‘#’+csdata.parents[i].split(‘#’)[1];
document.write(‘<a href=”‘+parenturl+'”>parent #’+(i+1)+'<\/a>’);
}//end for
document.write(‘)’);
}//end if
//]]>
</script>
- Insert this code where you want the links to replies to the comment (if there are any) to show up:
<script type=”text/javascript”>
//<![CDATA[
if(csdata.children && csdata.children[0] != ”) {
for(var i=0; i<csdata.children.length; i++) {
if(i > 0)
document.write(‘ | ‘);
childurl = ‘#’+csdata.children[i].split(‘#’)[1];
document.write(‘<a href=”‘+csdata.children[i]+'”>reply #’+(i+1)+'<\/a>’);
}//end for
}//end if
//]]>
</script>
- Insert this code where you want the link to the comment on Commentosphere and tags to show up:
<script type=”text/javascript”>
//<![CDATA[
if(csdata.id) {
document.write(‘ <a href=”http://comment.ning.com/index.php?id Commentosphere</a> ‘);
}//end if
if(csdata.tags && csdata.tags[0] != ”) {
document.write(‘ – Tags: ‘);
for(var i=0; i<csdata.tags.length; i++) {
document.write(‘ <a href=”csdata.id[i]+'”>’+csdata.tags[i]+'<\/a> ‘);
}//end for
}//end if
//]]>
</script>
- Save your template and republish your blog
http://del.icio.us/singpolyma.techblog/blogger
The XOXO Blog Format has been updated to be compatible with hAtom. Parsers are now expected to try to parse hAtom should no XOXO Blog Format data be present. Some sections of the format can be used with hAtom in this way, even if the data does not conform to the rest of the XOXO Blog Format. In this way hAtom can be extended, without forceing people to completely rewrite their blog templates.
The basic Blogger XOXO blog template has been updated to conform to the new format. It also has some new features, such as support for backlinks.