aboutsummaryrefslogtreecommitdiffstats
path: root/_layouts/posts_by_category.html
blob: 02892ee86b99b8638eacb6c14a0a265f2a5f2765 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
layout: default
---
<header class="post-header">
  <h1 class="post-title">Articles by category: {{ page.categories }}</h1>
</header>

<div class="post-content">

 <p>{{c_slug}}</p>


  {% if site.categories[page.categories] %}
    {% for post in site.categories[page.categories] %}
      {% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
      {% if forloop.first %}
          <h4>{{ post_year }}</h4>
          <div class="list-group">
      {% endif %}

      {% if forloop.first == false %}
        {% assign previous_index = forloop.index0 | minus: 1 %}
        {% capture previous_post_year %}{{ site.categories[page.categories][previous_index].date | date: '%Y' }}{% endcapture %}
        {% if post_year != previous_post_year %}
          </div>
          <h4>{{ post_year }}</h4>
          <div class="list-group">
        {% endif %}
      {% endif %}
        <ul class="posts">
          <li><a href="{{ post.url }}">{{ post.title }}</a> &raquo; <i><span>{{ post.date | date_to_string }}</span></i></li>
        </ul>
      {% if forloop.last %}
        </div>
      {% endif %}
    {% endfor %}
  {% else %}
    <p>There are no posts in this categories.</p>
  {% endif %}
</div>
Un proyecto texto-plano.xyz