Friday, June 15, 2012

How to Open SideBar Posts Links in a New Window

Opening your  sidebar posts/articles on a new window help in the sense that you do not want your readers to close your blog main page while reading the other posts. Even though the reader can still go back to the original page by using the back button, it much better if your blog remain open and visible to the reader. If your blog is still open, there is the possibility that the reader may get interested in checking more posts.

To make your posts open  in a new window, you need to put the target="_blank" attribute in your template.

Go to Blogger- Dashboard- Design- Edit HTML. Always make sure that your download your template before doing any changes, so that incase it does not work as you expected your can always replace it with the original template.  After downloading your template;


Click on Expand Widget Templates. Using CTRL + F.   Type the Title of the links/articles on your sidebar that you would like to open in a new browser. For this example; let say the title of my articles links is "Related Posts". So I am going to find "Related Posts" by using CTRL+ F. If you haven't given any title, you simply search for "widget id" using CTRL+ F. You will get a list of all links that is found on your side bar.

The tricky thing about using this method is that you really have to know the LinksList that you want change. All links on your sidebar are given different numbers which looks like this;  LinkList1,  LinkList2, LinkList3.  In my case, the  "Related Posts" is LinkList3 since I can see the link title.

By using CTRL+F and searching for Related Posts. I will be able to locate the following codes;

<b:widget id='LinkList3'   locked='false'     title='Related Posts'   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'> <data:link.name/></a></li>
     </b:loop>

I will then insert the target="_blank" attribute in the following code immediately after 'data:link.target' so that all articles that I will write under "Related Posts" will open in a new browser/tab. My new code will look like this;

<b:widget id='LinkList3' locked='false' title='Related Posts' 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>

Save your template and test whether it is working. If your click on the articles on your side bar, you will notice that they will all open on in a new browser window/Tab.


Related Posts
How to Open Hyperlinks in a New Window

0 comments:

Post a Comment