July 15, 2008

How to make external links in linklist widget open in a new window ?

Do you have exchange links with your friend's blog? I'm sure that some of us have a blogroll in sidebar. So how to make these links open in new windows? Follow these steps:

Step 1: Sign in your Blogger account, click Layout tab | Edit HTML, check Expand Widget Templates, scroll down and find your link list. You may also can find it by searching LinkList keyword.





Step 2: Now you put the colored code in this way and save your template:

<b:widget id='LinkList1' locked='false' title='Other blogs' type='LinkList'>
<b:includable id='main'>

<b:if cond='data:title'><h2><data:title/></h2></b:if>
<div class='widget-content'>
<ul>
<b:loop values='data:links' var='link'>
<li><a expr:href='data:link.target' target='_blank'><data:link.name/></a></li>
</b:loop>
</ul>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>


In the case of external links in posts, you could view this tip.

13 comments:

Thang said...

he..he.. this tip is used for classic template only, isn't it? You can use link list by opening a page element in Layout to add links without editing your template.

dv2n said...

@Thang, this tip is used for new blogger template. It makes an external link open in a new window only, having no affect on your link list data added in Layout.

redkathy said...

Thanks this works well. If you want only 1 new window for all links to open in, you can set target='new'

BayingAtTheMoon said...

OK. How do you make a double underline under id? I've tried it without the double underline and it doesn't work, so it must need one.

Aziajs said...

What am I doing wrong? I tried it and I get this error message:

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: Element type "a" must be followed by either attribute specifications, ">" or "/>".

Aziajs said...

Ok, I just realized my mistake. It is CRUCIAL that you include the space before target='_blank'

Tip Library said...

Works beautifully. So simple, yet so overlooked (on my part). You rock!

MightyBuying.com said...

Is there any way to make this work just for post/body links... I only want my blog posts to do this seeing I have so many external links.

Post a Comment

Amazon Contextual Product Ads