home.html 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. ---
  2. layout: page
  3. ---
  4. {{ content }}
  5. {% assign posts = paginator.posts | default: site.posts %}
  6. <!-- role="list" needed so that `list-style: none` in Safari doesn't remove the list semantics -->
  7. <ul class="posts-list list-unstyled" role="list">
  8. {% for post in posts %}
  9. <li class="post-preview">
  10. <article>
  11. {%- capture thumbnail -%}
  12. {% if post.thumbnail-img %}
  13. {{ post.thumbnail-img }}
  14. {% elsif post.cover-img %}
  15. {% if post.cover-img.first %}
  16. {{ post.cover-img[0].first.first }}
  17. {% else %}
  18. {{ post.cover-img }}
  19. {% endif %}
  20. {% else %}
  21. {% endif %}
  22. {% endcapture %}
  23. {% assign thumbnail=thumbnail | strip %}
  24. {% if site.feed_show_excerpt == false %}
  25. {% if thumbnail != "" %}
  26. <div class="post-image post-image-normal">
  27. <a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
  28. <img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
  29. </a>
  30. </div>
  31. {% endif %}
  32. {% endif %}
  33. <a href="{{ post.url | absolute_url }}">
  34. <h2 class="post-title">{{ post.title | strip_html }}</h2>
  35. {% if post.subtitle %}
  36. <h3 class="post-subtitle">
  37. {{ post.subtitle | strip_html }}
  38. </h3>
  39. {% endif %}
  40. </a>
  41. <p class="post-meta">
  42. {% assign date_format = site.date_format | default: "%B %-d, %Y" %}
  43. Posted on {{ post.date | date: date_format }}
  44. </p>
  45. {% if thumbnail != "" %}
  46. <div class="post-image post-image-small">
  47. <a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
  48. <img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
  49. </a>
  50. </div>
  51. {% endif %}
  52. {% unless site.feed_show_excerpt == false %}
  53. {% if thumbnail != "" %}
  54. <div class="post-image post-image-short">
  55. <a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
  56. <img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
  57. </a>
  58. </div>
  59. {% endif %}
  60. <div class="post-entry">
  61. {% assign excerpt_length = site.excerpt_length | default: 50 %}
  62. {{ post.excerpt | strip_html | truncatewords: excerpt_length }}
  63. {% assign excerpt_word_count = post.excerpt | number_of_words %}
  64. {% if post.content != post.excerpt or excerpt_word_count > excerpt_length %}
  65. <a href="{{ post.url | absolute_url }}" class="post-read-more">[Read&nbsp;More]</a>
  66. {% endif %}
  67. </div>
  68. {% endunless %}
  69. {% if site.feed_show_tags != false and post.tags.size > 0 %}
  70. <div class="blog-tags">
  71. <span>Tags:</span>
  72. <!-- role="list" needed so that `list-style: none` in Safari doesn't remove the list semantics -->
  73. <ul class="d-inline list-inline" role="list">
  74. {% for tag in post.tags %}
  75. <li class="list-inline-item">
  76. <a href="{{ '/tags' | absolute_url }}#{{- tag -}}">{{- tag -}}</a>
  77. </li>
  78. {% endfor %}
  79. </ul>
  80. </div>
  81. {% endif %}
  82. </article>
  83. </li>
  84. {% endfor %}
  85. </ul>
  86. {% if paginator.total_pages > 1 %}
  87. <ul class="pagination main-pager">
  88. {% if paginator.previous_page %}
  89. <li class="page-item previous">
  90. <a class="page-link" href="{{ paginator.previous_page_path | absolute_url }}">&larr; Newer Posts</a>
  91. </li>
  92. {% endif %}
  93. {% if paginator.next_page %}
  94. <li class="page-item next">
  95. <a class="page-link" href="{{ paginator.next_page_path | absolute_url }}">Older Posts &rarr;</a>
  96. </li>
  97. {% endif %}
  98. </ul>
  99. {% endif %}