Skip to content

Commit

Permalink
Add related posts option, closes barryclark#41.
Browse files Browse the repository at this point in the history
  • Loading branch information
johno committed Sep 25, 2014
1 parent f5ec4fa commit d9b75f2
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ baseurl: ""
url: "http://pixyll.com"
google_analytics:
animated: false
show_related_posts: false

# Build settings
markdown: kramdown
Expand Down
12 changes: 12 additions & 0 deletions _layouts/post.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,15 @@ <h1 class="py2">{{ page.title }}</h1>
<article class="post-content">
{{ content }}
</article>

{% if site.show_related_posts %}
<h3 class="related-post-title">Related Posts</h3>
{% for post in site.related_posts %}
<div class="post ml2">
<a href="{{ post.url | prepend: site.baseurl }}" class="post-link">
<h4 class="post-title">{{ post.title }}</h4>
<p class="post-summary">{{ post.summary }}</p>
</a>
</div>
{% endfor %}
{% endif %}
4 changes: 4 additions & 0 deletions _sass/_main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ body {
opacity: 0.88;
}

.related-post-title {
border-bottom: thin solid #f3f3f3;
}

.posts {
margin: 0;
}
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<div class="posts">
{% for post in paginator.posts %}
<div class="post {% if site.animated %}animated fade-in-down{% endif %}">
<div class="post">
<a href="{{ post.url | prepend: site.baseurl }}" class="post-link">
<p class="post-meta">{{ post.date | date: "%b %-d, %Y" }}</p>
<h3 class="h2 post-title">{{ post.title }}</h3>
Expand Down

0 comments on commit d9b75f2

Please sign in to comment.