Replace Older & Newer Post Links With Post Titles - Helper Blogger

Blogger Widgets | Templates | Tutorials

Latest

Tuesday, 13 March 2012

Replace Older & Newer Post Links With Post Titles

When you open a Blogger blog post, there are three links to Newer Post, Home, and Older Post at the bottom of the page. Unfortunately the Newer and Older post links only contain text "Newer Post" and "Older Post", not the actual post titles. Wordpress blog's display the post titles. But not Blogger.In this post change those static texts to dynamic post titles.We will apply this hack using jQuery.Just follow my steps and you will successfully replace your older and newer posts links with post titles.



How to replace older and newer posts links

1. Adding jQuery.
    For jQuery codes to work, first you have to load jQuery JavaScript library.


    (Note - Skip this step if you have already added jQuery to your blog)

    • Go to Blogger Dashboard > Design > Edit HTML.
    • Now find for </head> tag.
    • Add below code just above </head> tag.

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

    2.Adding The Blog Pager Code


    • Now go to Page/Edit Layout.
    • Click on Add a Gadget > HTML/Javascript.
    • Paste below code and save it.


    <!-- Post title blog pager by helperblogger.com START -->
    <style type="text/css"> 
    #blog-pager-newer-link {font-size:85%;width:200px;text-align:left;} 
    #blog-pager-older-link {font-size:85%;width:200px;text-align:right;} 
    </style> 
    <script type="text/javascript">
    $(document).ready(function(){ 
    var newerLink = $("a.blog-pager-newer-link").attr("href"); 
    $("a.blog-pager-newer-link").load(newerLink+" .post-title:first", function() { 
    var newerLinkTitle = $("a.blog-pager-newer-link").text(); 
    $("a.blog-pager-newer-link").text("<< " + newerLinkTitle); 
    }); 
    var olderLink = $("a.blog-pager-older-link").attr("href"); 
    $("a.blog-pager-older-link").load(olderLink+" .post-title:first", function() { 
    var olderLinkTitle = $("a.blog-pager-older-link").text(); 
    $("a.blog-pager-older-link").text(olderLinkTitle + " >>");//rgt 
    }); 
    }); 
    </script>
    <!-- Post title blog pager by helperblogger.com END -->


    On post pages it will show the actual titles of the next and previous posts. On index pages (i.e. homepage, label pages and archive pages) it will show the titles of the topmost post of the next and previous index pages. A tooltip with “Newer post” or “Older post” will appear when you hover the post title, making sure readers can tell which is which.

    10 comments:

    1. it will be very helpful if u show how to replace newer older link with post thumbnail instead of post title. I've seen this in a website..

      ReplyDelete
      Replies
      1. @Eusuf - can you tell me the address of that website? so that we will get the Idea to work further

        Delete
    2. This is great, thanks!

      ReplyDelete
    3. This comment has been removed by the author.

      ReplyDelete
    4. finally added that on my blog ,, i was searching but ,there was too long methods thanks rahul

      regards,
      H4ck3r Cracks

      ReplyDelete
    5. You should remember that it will load completely 3 pages instead of one every time user opens a page. I've discovered a better solution and described it here: http://blog-perevodov.blogspot.com/2012/09/blogger-replacing-older-and-newer-links.html. In short, I'm using external service to load data (and it's caching data too, so there's no multiple requests and delays every time somebody opens your posts). Try it, tell me what you think.

      ReplyDelete
    6. How to add the url of an image instead of "→" and "←"? Thanks

      ReplyDelete
    7. This is the fewest code to add and the shortest method to do the trick. Thanks!

      ReplyDelete

    If you want to be informed about any replies then check "Notify me" option (present at lower right corner of comment box and it will display if you are logged in to your google account). PLEASE DO NOT SPAM