archive.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!-- each category page -->
  2. {% if page.type %}
  3. <div class="archive">
  4. <p class="archive_type">{{ page.type }}</p>
  5. <ul>
  6. {% for post in site.categories[page.type] %}
  7. {% if post.url %}
  8. <li>
  9. <time class='archive_date' datetime='{{ post.date | date_to_xmlschema }}'>
  10. {{ post.date | date: "%b %-d, %Y" }}
  11. </time>
  12. <div class='archive_title'>
  13. <a href='{{ post.url | relative_url }}'>
  14. {{ post.title | escape }}
  15. </a>
  16. </div>
  17. </li>
  18. {% endif %}
  19. {% endfor %}
  20. </ul>
  21. </div>
  22. <!-- main page -->
  23. {% else %}
  24. <div class="archive">
  25. {% for post in site.posts %}
  26. {% unless post.next %}
  27. <p class="archive_year">{{ post.date | date: '%Y' }}</p>
  28. {% else %}
  29. {% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
  30. {% capture nextyear %}{{ post.next.date | date: '%Y' }}{% endcapture %}
  31. {% if year != nextyear %}
  32. <p class="archive_year">{{ post.date | date: '%Y' }}</p>
  33. {% endif %}
  34. {% endunless %}
  35. <ul>
  36. <li>
  37. <time class='archive_date' datetime='{{ post.date | date_to_xmlschema }}'>
  38. {{ post.date | date: "%b %d" }}
  39. </time>
  40. <div class='archive_title'>
  41. <a href='{{ post.url | relative_url }}'>
  42. {{ post.title | escape }}
  43. </a>
  44. </div>
  45. </li>
  46. </ul>
  47. {% endfor %}
  48. </div>
  49. {% endif %}