Skip to content

Commit

Permalink
Add previous and next links to blog posts
Browse files Browse the repository at this point in the history
  • Loading branch information
dguo committed Jun 25, 2018
1 parent 7a9d601 commit 5e8f017
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
20 changes: 18 additions & 2 deletions layouts/blog/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,25 @@ <h1>{{ .Title }}</h1>

{{ partial "anchor.html" .Content }}

<hr class="comments-separator">
<hr class="separator">

<div class="clearfix">
{{ with .PrevInSection }}
<span class="previous-link">
<a href="{{ .Permalink }}">← {{ .Title }}</a>
</span>
{{ end }}

{{ with .NextInSection }}
<span class="next-link">
<a href="{{ .Permalink }}">{{ .Title }} →</a>
</span>
{{ end }}
</div>

<hr class="separator">

{{ template "_internal/disqus.html" . }}

<div class="comments-separator">
<div class="separator">
{{ end }}
8 changes: 4 additions & 4 deletions static/css/general.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ hr {
border: 1px solid #eee;
}

hr.comments-separator {
margin-bottom: 50px;
hr.separator {
margin-bottom: 25px;
}

.comments-separator {
margin-top: 40px;
.separator {
margin-top: 25px;
}

footer {
Expand Down
12 changes: 12 additions & 0 deletions static/css/post.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,15 @@ h1 {
font-size: 0.9em;
margin-bottom: 2em;
}

.previous-link {
float: left;
text-align: left;
width: 48%;
}

.next-link {
float: right;
text-align: right;
width: 48%;
}

0 comments on commit 5e8f017

Please sign in to comment.