Showing Only Post Titles on Archive and Label Pages

When your contents grow, your index (multi-post) pages become bigger. This translates to longer loading time, and long loading time is of course no good to your blog because it sends your visitors away. One way to remedy this is by loading and showing only post titles on these pages. This will help speed up the loading time. It also make it easier for your visitors to browse your contents.
This hack will show only post titles on archive and label pages of your blog. Your homepage is unaffected.
  1. Login to your to your Blogger account.
  2. Go to Dashboard > Design > Edit HTML.
  3. Back up your template.
  4. Tick the  Expand Widget Templates checkbox on top right of the HTML window.
  5. In the code window, look for this line:
    <b:include data='post' name='post'/>
  6. Now replace that line with the code below (just copy & paste):
    01<!--Label and archive page title only hack-->
    02<b:if cond='data:blog.searchLabel'>
    03<h3 class='title-only'><a expr:href='data:post.url'><data:post.title/></a></h3>
    05<b:if cond='data:blog.pageType == "archive"'>
    06<h3 class='title-only'><a expr:href='data:post.url'><data:post.title/></a></h3>
    08<b:include data='post' name='post'/>
    Mar 2011: Revised entire code to prevent the hack from being applied to homepage's “Older posts”. You can see the old code below.
    Mar 2010: Revised code to prevent the hack from being applied to Blogger (static) Pages.

    The old code (for reference only). Click “Show source” to view. 
  7. Click Save Template.
  8. Here is the result for a label page, tested on this blog:title only
  9. To change the look of the titles, you have two options:
    • Use inline styling by inserting style attribute after <h3 in lines 3 and 6, like in this example :
      1<h3 style="margin-bottom: 15px;" class='title-only'><a expr:href='data:post.url'><data:post.title/></a></h3>
    • Add a separate element definition in CSS, like this: 
      1.title-only {
      2/* add styling codes here here */
      And place the it before ]]></b:skin> line in your HTML.
  10. Finish and enjoy!

Tidak ada komentar

No Spam / Ads or Outside Links