My blog has moved into Beta!



Please note that my blog has changed addresses! It's all new and improved. Hence this old friend of mine had to be left alone. You can visit me at The Last Word (beta). It's all warmed up for you! :)

« Home

Google SyncLatest Updated!Internet Wars: Watchya talking' about?Why not use favicons?A face in the crowdStatic Vs. DynamicGoogle Search API, now in AJAXUsing feeds to your advantageKeep it simple!A designer and a writer  »





Speaking to various people, I came to notice that the Link field isn't known to the general public too much. And those who know it, don't use it as its intended purpose. That's a little strange, considering the power a variable which holds data outside of a post can provide. So I'm going to try and explain its intended use, its more rampant use, and a script which modifies its use for the common man.

Intended use

The link field, as intended by Blogger (explanation), was meant to hold external links to posts. Many times, articles are related to each other which span over different blogs. They can be linked via links in the post. But somehow, if an article is derived from another article, then linking to it in a big way makes sense. Enter external links. If you haven't modified your template from a Blogger default template, try and add a link to your link field, and do a preview (by clicking the preview link on the top right). You'll see your title of the post changes to point to that link. Thats exactly what it does even on your blog (unmodified template ofcourse). If you see the titles of a few posts on my blog, you'll see a ~ prefixed. That means its a link. Click them, and you'll see they're linked to a post which is related to that post. Its a very good way of keeping people linked.

Rampant Use

I have seen people use this not for links, but a way of categorising their posts. Kirk (Phydeaux3) does it. Avatar (Bloggeratto) also does it. Gaby made a whole new category system based on it. It seems to be the easiest way to achieve this, since the data is held in a Blogger tag which is post specific, yet not a part of the post. All they need to do is write in the category names, and create a script to run through them and display the ones it needs to.

Very smart, but again, it defeats the purpose of a linked web. The titles are seen first and foremost with any post, and links within posts might be missed. But ones in titles will not. Which is why they're preferred to be used with titles (Blogger default setting).

Hybrid Link Field script

The idea from this stemmed because I want to see people use the link field for its original intended purpose. I wanted people to put links in there, but not break their current usage pattern. So I present to you, the Hybrid Link Field Use script.

The way to use this is very simple. In your link field you put in two kinds of details. The external link, and the categories a post is filed under. All seperated by commas (,). For example: http://somewhere.com, category-name-1, category-name-2. Leave the rest, for this script! :) To implement it, do the following. Put this bit of code in a pair of <script> </script> tags in your <head> area:

function extlink_tags(text, job, title){
    text=text.replace(/\s/ig, "");
    var part = text.split(',');
var tags = new Array();
    var output="";

if(job=='title'){
      
    for(var i=0;i<part.length;i++){
    if(part[i].match('http')) {output='<a href=\"'+part[i]+'\">'+title+'<\/a>'; break;}
            else {output=title; break;}  
    }
return document.write(output);
}
else{   
        for(var i=0;i<part.length;i++){
    if(!part[i].match('http')){
            output+="<a onclick=\"javascript:tags_s(\'"+part[i]+"\');\" title=\"View posts filed under "+part[i]+"\">"+part[i]+"<\/a> ";
            }   
    }

return document.write('Posted Under: '+output);
}

}

If you use my ABCI script, this code will automatically create links out of the category names it outputs, so that you click them and it'll load pull in the posts which are filed under that category. Now, put this part where you want your post title to appear:

<BlogItemTitle>
  <script>var link<$BlogItemNumber$>="";</script>
     
     <BlogItemURL><script>var link<$BlogItemNumber$>='<$BlogItemURL$>';</script></BlogItemURL>
       
        <script>
         if(link<$BlogItemNumber$>=="") document.write("<$BlogItemTitle$>");
         else extlink_tags(link<$BlogItemNumber$>, 'title', "<$BlogItemTitle$>");
       </script>
   </BlogItemTitle>

You can enclose this whole bunch of code within <div></div> tags so that you can style it anyway you want. Assign classes to them, and then use CSS to do so. This bunch takes into account your previous posts which might not have anything in the link field, so you have to go retro-linking your posts. You can start using it from the next post you make, and it'll show the change in that. Your oldies remain as they are!

Finally, the place where you want your categories to display as - Posted Under: (category name), put this line of code:

<BlogItemURL><div class="categ"><script>extlink_tags(link<$BlogItemNumber$>, 'tags', 'tags');</script></div></BlogItemURL>

That's it! You're done! I hope to see people begin to use the fields as they were meant to be used! Blogger can be such a powerful platform, sometimes people don't recognise its potential! Happy camping!

[Update]: My greasemonkey script (Del.icio.us tag reference adder) works perfectly with this script! Give it a go!


2 Comments

ah, i found this post refreshing, using the link field for link and the categories is something great to have..





Leave your comment
You can use some HTML tags, such as <b>, <i>, <a>

Or you can sign in as a different user.







Categories

Latest Updated

Subscriptions

Get My Blog In Your Mail!

Powered by Yutter

add this button to your site/blog as a link to this page! « link to me!
coComments my coComments
my claimID

subscribe to feed
Widgetize!
Google Reader add to google
del.icio.us The Last Word add to del.icio.us
Add to My Yahoo! add to yahoo!
Subscribe with Bloglines add to bloglines
add to msn
Add to netvibes add to Netvibes!
myFeedster add to feedster
Furl The Last Word add to furl


Archive Pages
January 2006 February 2006 March 2006 April 2006 May 2006 June 2006 July 2006 August 2006 October 2006 November 2006 December 2006

Advertisement


Song Of The Day:




Creative Commons License Widgetize!
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.
Aditya Mukherjee © 2005-06 | Powered by Blogger