Today I will give an example of another life experience working with a blogger. I remember on my first blog I wanted to clean up a lot, this included the Next and Previous links. And you know, these components of the template should not be deleted, I can even explain why.
In general, these links are important, both for normal SEO optimization of the site - blog and for their visitors. With them, the site - the blog becomes more SEO friendly, in short, the search engines like it, because with the help of Next and Previous links, it is easier for them to rush through your web resources.
The same is with the visitors, only it is not SEO optimization that is friendly here, but the design or functionality as you like. A living example, a visitor of your blog has read a post and in order not to return to the main page, he can continue reading your content using these links.
How to Add in Blogger Next and Previous Post with Titles
To add this widget (DEMO) to your blog:
1. Go to your Blogger Dashboard
2. Choose Theme - Edit HTML
3. Now Press on your Keyboard CTRL+F and in the search window write ]]></b:skin>
and press Enter, before this code you need paste this CSS:
.pagernav {margin-top: 20px; background:#fff;padding:10px 0;border:1px solid #eee;border-top:0;}
.turn-left{width:50%;float:left;margin:0;text-align:left;color:#bbb;transition:all .3s ease-out;}
.turn-right{width:50%;float:right;margin:0;text-align:right;color:#bbb;transition:all .3s ease-out}
.turn-right:hover .pager-title-left,.turn-left:hover .pager-title-left{color:#ddd!important;}
.turn-left a,.turn-right a{color:#999;}
.turn-right a:hover,.turn-left a:hover{color:#666!important;}
.turn-left a,.turn-right a{font-size: 22px; font-weight: 700; text-transform: uppercase;}
.pager-title-left{font-family: 'Open Sans',sans-serif;font-size:22px;font-weight:700;text-transform:uppercase;transition:all .3s ease-out}
.blog-left{margin:0}
.blog-right{margin:5px 10px 10px}
#blog-pager-newer-link{float:left;padding:0 0 0 15px;}
#blog-pager-older-link{float:right;padding:0 15px 0 0;}
.blog-pager,#blog-pager{clear:both;text-align:center}
4. Next step, find in your Theme data:post.body
and after it add this HTML:
<b:if cond='data:blog.pageType == "item"'>
<div class='pagernav'>
<div class='blog-pager' id='blog-pager'>
<div class='turn-left'>
<div class='blog-left'>
<b:if cond='data:newerPageUrl'>
<span id='blog-pager-newer-link'>
<span class='pager-title-left'>Previous Post</span><br/>
<a class='blog-pager-newer-link' expr:href='data:newerPageUrl' expr:id='data:widget.instanceId + "_blog-pager-newer-link"' expr:title='data:newerPageTitle'>« Prev Post</a>
</span>
<b:else/>
<span class='current-pageleft'><span class='pager-title-left'>Latest</span></span>
</b:if>
</div>
</div>
<div class='turn-right'>
<div class='blog-right'>
<b:if cond='data:olderPageUrl'>
<span id='blog-pager-older-link'>
<span class='pager-title-left'>Next Post</span><br/>
<a class='blog-pager-older-link' expr:href='data:olderPageUrl' expr:id='data:widget.instanceId + "_blog-pager-older-link"' expr:title='data:olderPageTitle'>Next Post »</a>
</span>
<b:else/>
<span class='current-pageright'><span class='pager-title-left'>First</span></span>
</b:if>
</div>
</div>
</div>
<div style='clear: both;'/>
</div>
</b:if>
5. Final step scroll page down until </body>
and paste before it this JS:
<script type='text/javascript'>
//Pager
$(document).ready(function(){
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);
});
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:first").text();
$("a.blog-pager-newer-link").text(newerLinkTitle);
});
});
</script>
Now Save new settings and check the result.
If post titles not showing up just add before </head>
this jquery code:
<script src='https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
Video instruction
That's all, enjoy. And if you have any questions write it in the comments below.
9 Comments
Post titles are showing up but the previous post does not seem to be getting CSS applied any ideas?
Try to add CSS after closing tag skin, using style tag
Hello, the "more posts" is disappearing when entering this code?
No. But first make copy of your theme.
Thank you - will do.
If there are 3 posts on blog: post 1 on 1st january 2023, post 2 on 2nd january 2023, post 3 on 3rd january 2023.
Scenario: Now I am on Page Post 2.
I want Previous post is post 1
And Next Post is post 3.
How to do this?
This navigation is already perform this function, so just replace in the HTML title of the "next post" with the "previous post" and vice versa.
Bro is this possible to show without Jquery library??
Help please
You can, but then there will be no post titles only the next previous post.