Merge pull request #94 from dapenggao/patch-2
authorMark Otto <markd.otto@gmail.com>
Sun, 21 Jun 2015 23:36:53 +0000 (16:36 -0700)
committerMark Otto <markd.otto@gmail.com>
Sun, 21 Jun 2015 23:36:53 +0000 (16:36 -0700)
Hide "Related Posts" section if it is empty

1  2 
_layouts/post.html

diff --combined _layouts/post.html
index 17433f3ef436a6f4ba9d6ff3d615d3afc3ab589a,5554be9f20d1a393c8ff0c1e0ae970396bbe719f..ec63afc10d770bfaf47daee2c3d2231ce39c8c05
@@@ -8,13 -8,14 +8,14 @@@ layout: defaul
    {{ content }}
  </article>
  
+ {% if site.related_posts != empty %}
  <aside class="related">
    <h2>Related Posts</h2>
    <ul class="related-posts">
      {% for post in site.related_posts limit:3 %}
        <li>
          <h3>
 -          <a href="{{ site.baseurl }}/{{ post.url }}">
 +          <a href="{{ site.baseurl }}{{ post.url }}">
              {{ post.title }}
              <small><time datetime="{{ post.date | date_to_xmlschema }}">{{ post.date | date_to_string }}</time></small>
            </a>
@@@ -23,3 -24,4 +24,4 @@@
      {% endfor %}
    </ul>
  </aside>
+ {% endif %}