Skip to content

Commit

Permalink
add show_related option
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Buschmann committed Feb 4, 2020
1 parent a106b2b commit 3e94765
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ date_format: "%B %d, %Y"

sidebar: true # show a sidebar instead of the usual header
show_excerpts: false # show article excerpts on the home page
show_related: true # show the previous and next links after every post
dark_header: false # keep the top-header dark
hide_title: false # hide the site title in the header
minimal: false # minima-inspired style without box-shadows
Expand Down
9 changes: 9 additions & 0 deletions _includes/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ <h1><a href="{{ include.post.url | relative_url }}">{{ include.post.title }}</a>
<div><a href="{{ include.post.url | relative_url }}">read more</a></div>
{% else %}
{{ include.post.content }}
{% if site.show_related %}
<p class="separator">Related posts</p>
{% if include.post.next.url %}
<p class="related"><span>Next Post</span><a href="{{ include.post.next.url | relative_url }}">{{ include.post.next.title }}</a></p>
{% endif %}
{% if include.post.previous.url %}
<p class="related"><span>Previous Post</span><a href="{{ include.post.previous.url | relative_url }}">{{ include.post.previous.title }}</a></p>
{% endif %}
{% endif %}
{% if include.post.comments != false and site.comments.isso or site.comments.disqus %}
<hr>
{% if site.comments.isso %}<div id="isso-thread"></div>{% endif %}
Expand Down
25 changes: 25 additions & 0 deletions assets/css/classes.sass
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@
.categories + h1
margin: .1em 0

{% if site.show_related %}

.separator
display: flex
color: reduce(100)
margin: 2em -.8em

.separator::before, .separator::after
display: block
content: " "
margin: .8em
border-top: 1px solid reduce(26)
flex: 1

.related span
display: block
color: reduce(100)

.related a
color: inherit
font-size: 1.2em
font-weight: bold

{% endif %}

{% if site.sidebar %}

.hidden
Expand Down

0 comments on commit 3e94765

Please sign in to comment.