Southern Listeners

Loading
Thanks to Greenlava for this cool gadget. Get yours here

Thursday, October 21, 2010

How to Customize Links and Tabs on Pages Gadget

This is a quick tutorial on how to customize links and tabs on pages gadget, in case you want to have a tab to link to some other URL instead of your static pages alone (how selfish the current limitation is!). Do note that after this hack, you won't be able to edit your pages gadget directly by clicking on 'Edit' on your Pages Gadget from Page Element. You'd have to code it each time you wanna make changes. So if you have added a new static page, it wont automatically show on your Pages Gadget unless you make the necessary changes.

Make sure you have already added your Pages Gadget before attempting this tutorial.

Update: With the new Blogger interface, you can add external links to your Pages gadget.


Step 1:

View you blog using Firefox (or any other browser that lets you to view the page source) - Right Click - View Page Source

Step 2:

Copy Everything from <ul> to </ul>. Mine looks something like this:


Step 3:

This is where you will edit your code. This is the code that I have copied from page source.

<li class="selected"><a href="http://yoboytestblog3.blogspot.com/">Home</a></li>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-1.html">Background 1</a></li>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-2.html">Background 2</a></li>

If you want additional links to your Pages Gadget, you gotta add more lines to the above code. Say I want my second tab to be linking to my other Blog, and I want the tab to say 'My Other Blog', so my code now looks like this:

<li class="selected"><a href="http://yoboytestblog3.blogspot.com/">Home</a></li>
<li><a href="http://www.southernspeakers.blogspot.com/">My Other Blog</a></li>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-1.html">Background 1</a></li>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-2.html">Background 2</a></li>

Step 4:

If you want to retain the highlight feature that your tab has (the tab which is being clicked will be highlighted), do this step. Otherwise, you can skip this step, but you gotta remove the ' class='selected'' part of your code, so that it would similar to other lines in your code.

Note: (skip this paragraph if you are not adding label query to your Pages Gadget) I am sure many of you want to add label search query as a link in the previous step. I must warn you, if you don't care about the highlight feature, this is not a concern. You can add a label query like http://www.southernspeakers.blogspot.com/search/label/Tutorial normally, but if you want the highlight feature to work, your label must end with .html, so your label will be something line Tutorial.html, and your label query page will look something like http://www.southernspeakers.blogspot.com/search/label/Tutorial.htnml . This is just a way to trick blogger to enable the highlight feature. Check out the following tutorial for a detailed walkthrough:
http://southernspeakers.blogspot.com/2010/10/label-sorted-posts-from-menu-bar.html


This is the code that I have after completing the previous step:

<li class="selected"><a href="http://yoboytestblog3.blogspot.com/">Home</a></li>
<li><a href="http://www.southernspeakers.blogspot.com/">My Other Blog</a></li>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-1.html">Background 1</a></li>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-2.html">Background 2</a></li>

I am going to modifiy this code. Modifying is a must to have the highlight feature available. This is the code that I have after modifying it.

<b:if cond="data:blog.url == &quot;http://yoboytestblog3.blogspot.com/&quot;">
<li class="selected"><a href="http://yoboytestblog3.blogspot.com/">Home</a></li>
<b:else/>
<li><a href="http://yoboytestblog3.blogspot.com/">Home</a></li>
</b:if>

<b:if cond="data:blog.url == &quot;http://www.southernspeakers.blogspot.com/&quot;">
<li class="selected"><a href="http://www.southernspeakers.blogspot.com/">My Other Blog</a></li>
<b:else/>
<li><a href="http://www.southernspeakers.blogspot.com/">My Other Blog</a></li>
</b:if>

<b:if cond="data:blog.url == &quot;http://yoboytestblog3.blogspot.com/p/background-1.html&quot;">
<li class="selected"><a href="http://yoboytestblog3.blogspot.com/p/background-1.html">Background 1</a></li>
<b:else/>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-1.html">Background 1</a></li>
</b:if>

<b:if cond="data:blog.url == &quot;http://yoboytestblog3.blogspot.com/p/background-2.html&quot;">
<li class="selected"><a href="http://yoboytestblog3.blogspot.com/p/background-2.html">Background 2</a></li>
<b:else/>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-2.html">Background 1</a></li>
</b:if>

Easy, don't panic. The following image will show you exactly what I did to our original code:


Step 5:

Now that we have prepared our code, it's time to put it at its place. Please backup your template before doing this. From Dashboard - Design - Edit HTML - Expand Widget Templates - Delete everything between <ul> and </ul>, and place our code there. This is how my portion of the code looks like:

<b:section class="tabs" id="crosscol" maxwidgets="1" showaddelement="yes">
<b:widget id="PageList2" locked="false" title="Pages" type="PageList">
<b:includable id="main">
  <b:if cond="data:title"><h2>
<data:title></data:title></h2>
</b:if>
  <div class="widget-content">
<ul>

<b:if cond="data:blog.url == &quot;http://yoboytestblog3.blogspot.com/&quot;">
<li class="selected"><a href="http://yoboytestblog3.blogspot.com/">Home</a></li>
<b:else/>
<li><a href="http://yoboytestblog3.blogspot.com/">Home</a></li>
</b:if>

<b:if cond="data:blog.url == &quot;http://www.southernspeakers.blogspot.com/&quot;">
<li class="selected"><a href="http://www.southernspeakers.blogspot.com/">My Other Blog</a></li>
<b:else/>
<li><a href="http://www.southernspeakers.blogspot.com/">My Other Blog</a></li>
</b:if>

<b:if cond="data:blog.url == &quot;http://yoboytestblog3.blogspot.com/p/background-1.html&quot;">
<li class="selected"><a href="http://yoboytestblog3.blogspot.com/p/background-1.html">Background 1</a></li>
<b:else/>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-1.html">Background 1</a></li>
</b:if>

<b:if cond="data:blog.url == &quot;http://yoboytestblog3.blogspot.com/p/background-2.html&quot;">
<li class="selected"><a href="http://yoboytestblog3.blogspot.com/p/background-2.html">Background 2</a></li>
<b:else/>
<li><a href="http://yoboytestblog3.blogspot.com/p/background-2.html">Background 1</a></li>
</b:if>       

</ul>
<b:include name="quickedit">
  </b:include></div>
</b:includable>
</b:widget>
</b:section>

Save Template and there you have it. Happy trying. I can think of lots of reasons why you want to edit your Pages Gadget. But to go through all this trouble is not worth it in my opinion. Always opt to use Link List gadget as a substitute for your Pages Gadget. You can edit links easily. The only thing you will be giving up is the 'highlighted tabs' feature that comes built in with Pages Gadget.

7 comments:

  1. Hey...

    My question is HOW to customize the tabs with a picture? Like a jpeg pic for "home", an other jpeg for "contact me" an other jpeg for " tutorials" and so on..

    Thanks in advance

    ReplyDelete
  2. @Paper Swan: Instead of editting your pages gadget to include pictures, a simpler alternative would be to use an HTML/Javascript gadget. You can add a basic one-buttoned menu like this:

    <a href="http://www.southernspeakers.net/"><img src="http://i.imgur.com/s5SwO.png" /></a>

    In the code above, the first address is your target link, and the second address is the address of your image. Simply change these two addresses, and the rest remains the same. This is all you have to do to create a button.

    To have a pictorial menu, I believe you're gonna need more than one single button. To add more than one button in a row, simple add the individual button codes together, in a line. For example:

    <a href="http://www.southernspeakers.net/"><img src="http://i.imgur.com/s5SwO.png" /></a><a href="http://www.southernspeakers.net/"><img src="http://i.imgur.com/s5SwO.png" /></a><a href="http://www.southernspeakers.net/"><img src="http://i.imgur.com/s5SwO.png" /></a>

    Feel free to copy and paste this code to an HTML/Javascript gadget to see what it does.

    ReplyDelete
  3. Hi,Mr.Yoga :)
    may u do me a favor?
    i had tried many times,but still have no idea how to add
    links/tab into the menu bar,can u help me to figure it out what's going on?

    i had post the picture in my blog,check here
    http://twlemb.blogspot.com/2012/08/blog-post_2286.html

    a million of thanks and appreciate for your help :)

    ReplyDelete
  4. Mr.Yoga,i'm sorry to inform u,because many error occur in my blog
    (oh my gosh...i'm beginner to blogger,haha,there is so many mistake i make,now i change the domain name)

    here is it http://idonnohowtouse.blogspot.com/,please help me figure it out,how to add tab in menu bar and how to add gadjet like zabou

    http://resine-et-chiffons.blogspot.com/

    ReplyDelete
    Replies
    1. Hi TWL,

      To add a link to your menu, go to Dashboard - Pages - New Page - Web Address.. You could also choose the 'Blank Page' option if you want to create a dedicated page in your menu.

      As for adding gadgets, go to Dashboard - Layout - Add a Gadget - and choose the gadgets that says 'Available for Dynamic Views' (in red font).

      The other website that you've linked in your comment (zabou) has tweaked the icons for the gadget. You can do the same by using the following tutorial:
      http://www.southernspeakers.net/2012/03/change-gadget-icons-in-blogger-dynamic.html

      All the best :)

      Delete
  5. Hi I am wondering if how i can have links to my header like home, follow, categories, etc...

    an example to that is found in this blog: http://www.wardrobeflux.com/

    I have tried everything i read but I can't make it work. Please help!
    thanks!

    currently this is how my blog looks like:
    http://www.whatevereveramen.com/


    thank you!
    Abi

    ReplyDelete
    Replies
    1. Hi Abi,

      What you need is a personalised set of codes, and someone to do it for you.

      Here you go. Add this to your CSS:

      #navbar{
      display: none !important;
      }
      .tabs-outer{
      border: 1px solid black;
      position: absolute !important;
      top: 0px !important;
      width: 100% !important;
      padding-left: 100% !important;
      margin-left: -100% !important;
      background: black !important;
      }
      .tabs-inner .widget li a, .tabs-inner .widget ul{
      border: 0px !important;
      }

      Cheers :)

      Delete

Please use the 'Ask a Question' page to shoot questions that are not related to the tutorial in the post above.