Monday, September 18, 2006

Open feed’s links in new window

Based on the hack/mod I suggested in my article on link-lists in blogger beta, I have extended the same idea to feed displays that one may have in their blog.

Feeds are a powerful and popular means of staying updated and they are also powerful distracters on a blog. If you have feeds to other blogs or news sites (like I have), it would be a good idea to use the code given below. If you are new to HTML etc just make sure you backup your template before proceeding with this hack.

Depending on the number of feeds you have in your blog, blogger names each feed widget as Feed1, Feed2 etc. To find out the blogger-assigned name of a particular feed widget, just hover your mouse cursor over the edit link of that widget in the layout -> page elements section of your blogger account and in the browser’s status bar you will see a link with the blogger assigned name a.k.a the widget ID.[edited]&

However, this exercise may not be required if you have assigned a title to your feed widget. You can search for a particular feed widget’s code in your template using its title or the widget ID. Once you have located the feed widget you wish to modify, you should look for the following code in there. Look for the line which goes <a expr:href='data:i.alternate.href'… and add a target='_blank' to it and you are done. Simple isn’t it?

<b:widget id='Feed2' locked='false' title='Reuters: Top News' type='Feed'>
<b:includable id='main'>
[blah blah!]
<ul id='feedItemListDisplay'>
<b:loop values='data:feedData.items' var='i'>
<span class='item-title'>
<a expr:href='data:i.alternate.href' target='_blank'>

I have applied this hack only to third-party feeds in my blog. If you are using your own feed to display recent posts etc this may not be required as even if some one clicks on a link in that feed widget, they remain on your blog.

As always, if you face any problems, just drop a line here and I shall look into it. Also note that this hack is only for blogger beta blogs.


Anonymous said...

Hi Vivek, Ramani and I have a new release of peek-a-boo posts available.

You can expand and collapse the posts, and a short post without summary has no "Continue reading" link.

Come check it out at Beautiful Beta.

Vivek Sanghi said...

I just read it. Sounds good! Will implement today. thanks.

Anonymous said...

Is it possible to have the "_blank" integrated into the template? So that I don't have to change the HTML manually every time I insert a link into the post?

Vivek Sanghi said...

I researched a lot on that one. Unfortunately could not find a solution. I think there is no way to do it except manually. You can try suggesting this to Blogger. domain is banned by my ISP so I can't reach their help pages, else I would have requested that feature.

PRESHA said...

Thanks for the good tip it's working fine ;)

Other posts @ Stubborn Fanatic

Click here to view all my posts.

< ? indian bloggers # >

« | # | RingSurf | ? | »

Top of Page

Creative Commons License
This work is licensed under a
Creative Commons Attribution-ShareAlike 2.5 License.

However, prior permission is required before you can display any content from this blog on your site. The author reserves the right to demand removal of such content at any time for any reason. (Not applicable for back-linking)
Note: The author is not responsible for any loss of data or damages to your homepage as a result of using the hacks suggested here. Please observe all necessary precautions while modifying template code.

© 2006 Vivek Sanghi a.k.a Stubborn-Fanatic