home.html 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ---
  2. layout: page
  3. ---
  4. {{ content }}
  5. {% assign posts = paginator.posts | default: site.posts %}
  6. <div class="posts-list">
  7. {% for post in posts %}
  8. <article class="post-preview">
  9. <a href="{{ post.url | absolute_url }}">
  10. <h2 class="post-title">{{ post.title }}</h2>
  11. {% if post.subtitle %}
  12. <h3 class="post-subtitle">
  13. {{ post.subtitle }}
  14. </h3>
  15. {% endif %}
  16. </a>
  17. <p class="post-meta">
  18. {% assign date_format = site.date_format | default: "%B %-d, %Y" %}
  19. Posted on {{ post.date | date: date_format }}
  20. </p>
  21. <div class="post-entry-container">
  22. {%- capture thumbnail -%}
  23. {% if post.thumbnail-img %}
  24. {{ post.thumbnail-img }}
  25. {% elsif post.cover-img %}
  26. {% if post.cover-img.first %}
  27. {{ post.cover-img[0].first.first }}
  28. {% else %}
  29. {{ post.cover-img }}
  30. {% endif %}
  31. {% else %}
  32. {% endif %}
  33. {% endcapture %}
  34. {% assign thumbnail=thumbnail | strip %}
  35. {% if thumbnail != "" %}
  36. <div class="post-image">
  37. <a href="{{ post.url | absolute_url }}">
  38. <img src="{{ thumbnail | absolute_url }}">
  39. </a>
  40. </div>
  41. {% endif %}
  42. <div class="post-entry">
  43. {% assign excerpt_length = site.excerpt_length | default: 50 %}
  44. {{ post.excerpt | strip_html | xml_escape | truncatewords: excerpt_length }}
  45. {% assign excerpt_word_count = post.excerpt | number_of_words %}
  46. {% if post.content != post.excerpt or excerpt_word_count > excerpt_length %}
  47. <a href="{{ post.url | absolute_url }}" class="post-read-more">[Read&nbsp;More]</a>
  48. {% endif %}
  49. </div>
  50. </div>
  51. {% if post.tags.size > 0 %}
  52. <div class="blog-tags">
  53. Tags:
  54. {% if site.link-tags %}
  55. {% for tag in post.tags %}
  56. <a href="{{ '/tags' | absolute_url }}#{{- tag -}}">{{- tag -}}</a>
  57. {% endfor %}
  58. {% else %}
  59. {{ post.tags | join: ", " }}
  60. {% endif %}
  61. </div>
  62. {% endif %}
  63. </article>
  64. {% endfor %}
  65. </div>
  66. {% if paginator.total_pages > 1 %}
  67. <ul class="pagination main-pager">
  68. {% if paginator.previous_page %}
  69. <li class="page-item previous">
  70. <a class="page-link" href="{{ paginator.previous_page_path | absolute_url }}">&larr; Newer Posts</a>
  71. </li>
  72. {% endif %}
  73. {% if paginator.next_page %}
  74. <li class="page-item next">
  75. <a class="page-link" href="{{ paginator.next_page_path | absolute_url }}">Older Posts &rarr;</a>
  76. </li>
  77. {% endif %}
  78. </ul>
  79. {% endif %}