Wednesday, July 4, 2007

Making links in a Blogger Beta link list open in new window

Wednesday, July 4, 2007
In Blogger Beta, if you add a Link List, the links created open in the same folder by default.

Here is how you can make links open in new windows/tabs. Sign into Dashboard, for the relvant blog, click LAYOUT, then EDIT TEMPLATE. Check EXPAND WIDGET TEMPLATES. Look for this block of codes:


<b:widget id='LinkList1' locked='false' title='Blogger Resources' type='LinkList'>
<b:includable id='main'>
<b:if cond='data:title'><h2><data:title/></h2></b:if>
<div class='widget-content'>
<ul>
<div id='link'>
<b:loop values='data:links' var='link'>
<li><a expr:href='data:link.target' ><data:link.name/></a></li>
</b:loop>
</div>
</ul>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>
</b:section>



Look particularly for this code:
<li><a expr:href='data:link.target' ><data:link.name/></a>

Replace it with
<li><a expr:href='data:link.target'target="_blank"><data:link.name/></a> //in other words, add target="_blank" after expr:href='data:link.target'. Make sure there is a space between them (see update).

Save template and check that the links actually open in a new window. This has been done for this blog. Try clicking on the links in the link lists (Blogger Resources) and confirm that they actually open in a new window/tab.

Note: As always, whenever you make changes to the template, backup the current template first.

UPDATE: 2 person commented of problems executing this hack. Read the comments. I retested it for this blog Good Health Information and confirmed the hack work. Check for yourself. The link list is titled "Blogger Resources" and is the second last in the right sidebar. Click on the links and confirm for yourself that they open in new windows/tabs. Just a note. Make sure that there is a space between
expr:href='data:link.target'
and
target="_blank".
AddThis Social Bookmark Button

0 comments: