home.html 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. {% if post.author %}
  42. <span>By <strong>{{ post.author | strip_html }}</strong></span>
  43. {% endif %}
  44. <p class="post-meta">
  45. {% assign date_format = site.date_format | default: "%B %-d, %Y" %}
  46. Posted on {{ post.date | date: date_format }}
  47. </p>
  48. {% if thumbnail != "" %}
  49. <div class="post-image post-image-small">
  50. <a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
  51. <img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
  52. </a>
  53. </div>
  54. {% endif %}
  55. {% unless site.feed_show_excerpt == false %}
  56. {% if thumbnail != "" %}
  57. <div class="post-image post-image-short">
  58. <a href="{{ post.url | absolute_url }}" aria-label="Thumbnail">
  59. <img src="{{ thumbnail | absolute_url }}" alt="Post thumbnail">
  60. </a>
  61. </div>
  62. {% endif %}
  63. <div class="post-entry">
  64. {% assign excerpt_length = site.excerpt_length | default: 50 %}
  65. {{ post.excerpt | strip_html | truncatewords: excerpt_length }}
  66. {% assign excerpt_word_count = post.excerpt | number_of_words %}
  67. {% if post.content != post.excerpt or excerpt_word_count > excerpt_length %}
  68. <a href="{{ post.url | absolute_url }}" class="post-read-more">[Read&nbsp;More]</a>
  69. {% endif %}
  70. </div>
  71. {% endunless %}
  72. {% if site.feed_show_tags != false and post.tags.size > 0 %}
  73. <div class="blog-tags">
  74. <span>Tags:</span>
  75. <!-- role="list" needed so that `list-style: none` in Safari doesn't remove the list semantics -->
  76. <ul class="d-inline list-inline" role="list">
  77. {% for tag in post.tags %}
  78. <li class="list-inline-item">
  79. <a href="{{ '/tags' | absolute_url }}#{{- tag -}}">{{- tag -}}</a>
  80. </li>
  81. {% endfor %}
  82. </ul>
  83. </div>
  84. {% endif %}
  85. </article>
  86. </li>
  87. {% endfor %}
  88. </ul>
  89. {% if paginator.total_pages > 1 %}
  90. <ul class="pagination main-pager">
  91. {% if paginator.previous_page %}
  92. <li class="page-item previous">
  93. <a class="page-link" href="{{ paginator.previous_page_path | absolute_url }}">
  94. <i class="fas fa-arrow-left" alt="Newer Posts"></i>
  95. <span class="d-none d-sm-inline-block">Newer Posts</span>
  96. </a>
  97. </li>
  98. {% endif %}
  99. {% if paginator.next_page %}
  100. <li class="page-item next">
  101. <a class="page-link" href="{{ paginator.next_page_path | absolute_url }}">
  102. <span class="d-none d-sm-inline-block">Older Posts</span>
  103. <i class="fas fa-arrow-right" alt="Older Posts"></i>
  104. </a>
  105. </li>
  106. {% endif %}
  107. </ul>
  108. {% endif %}