Skip to content

Instantly share code, notes, and snippets.

@amc1981
Last active August 2, 2023 10:53
Show Gist options
  • Save amc1981/68b9722b4b084148e92d6f07fa6136ab to your computer and use it in GitHub Desktop.
Save amc1981/68b9722b4b084148e92d6f07fa6136ab to your computer and use it in GitHub Desktop.
---
layout: default
---
<div class="container">
{% if site.tags[page.slug] %}
<!-- bucle principal -->
{% for post in site.tags[page.slug] %}
{% capture post_year %}{{ post.date | date: '%Y' }}{% endcapture %}
{% if forloop.first %}
<h3 class="year">{{ post_year }}</h3>
<div class="list-group">
{% endif %}
{% unless forloop.first %}
{% assign previous_index = forloop.index0 | minus: 1 %}
{% capture previous_post_year %}{{ site.tags[page.slug][previous_index].date | date: '%Y' }}{% endcapture %}
{% if post_year != previous_post_year %}
</div>
<h3 class="year">{{ post_year }}</h3>
<div class="list-group">
{% endif %}
{% endunless %}
<a href="{{ site.baseurl }}{{ post.url }}" class="list-group-item">
<h4 class="list-group-item-heading">{{ post.title }}</h4>
<p class="list-group-item-date">{{ post.date | date: "%-d/%-m/%Y" }}</p>
</a>
{% if forloop.last %}
</div>
{% endif %}
{% endfor %}
<!-- fin bucle principal -->
{% else %}
<p>No existen posts para este TAG.</p>
{% endif %}
</div>
---
layout: page
title: Etiquetas
---
{% for tag in site.tags %}
<h4><a href="/blog/tags/{{ tag[0] }}"> {{ tag[0] }} </a></h4>
<ul>
{% for post in tag[1] %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}
<hr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment