Skip to content

Commit caa795d

Browse files
author
Ram swaroop
committed
prev/next post done
1 parent 950d0b6 commit caa795d

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

_layouts/post.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ <h1 class="title">{{ page.title }}</h1>
1515
<section class="post-content">{{ content }}</section>
1616
</article>
1717

18+
<!-- Post navigation -->
19+
<div id="post_nav">
20+
{% if page.previous.url %}
21+
<a class="prev" href="{{ page.previous.url }}" {% if page.next.url == null %} style="border-right:1px solid rgba(0, 0, 0, 0.1)" {% endif %}><h4>{{ page.previous.title }}</h4> &laquo; {{ site.theme.str_prev }}</a>
22+
{% endif %}
23+
{% if page.next.url %}
24+
<a class="next" href="{{ page.next.url }}" {% if page.previous.url == null %} style="margin-left:50%;border-left:1px solid rgba(0, 0, 0, 0.1)" {% else %} style="border-left:1px solid rgba(0, 0, 0, 0.1)" {% endif %}><h4>{{ page.next.title }}</h4> {{ site.theme.str_next }} &raquo;</a>
25+
{% endif %}
26+
</div>
27+
1828
<!-- Disqus -->
1929
{% if site.theme.disqus_shortname %}
2030
<div class="comments">

_sass/layouts/_posts.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ header {
4848
}
4949
}
5050

51+
/** Custom **/
5152
.share-bar {
5253
text-align: center;
5354
display: none;
@@ -56,3 +57,22 @@ header {
5657
vertical-align: top;
5758
margin: 20px 0;
5859
}
60+
// Post navigation (next/prev post)
61+
#post_nav {
62+
width:100%;
63+
display: inline-block;
64+
border-bottom: 1px solid $border-color;
65+
}
66+
#post_nav .prev {
67+
@extend %padding-regular;
68+
width: 50%;
69+
display: inline-block;
70+
float: left;
71+
text-align: left;
72+
}
73+
#post_nav .next {
74+
@extend %padding-regular;
75+
width: 50%;
76+
display: inline-block;
77+
text-align: right;
78+
}

0 commit comments

Comments
 (0)