-
Notifications
You must be signed in to change notification settings - Fork 11.5k
/
Copy pathlatest_posts.liquid
48 lines (48 loc) · 1.84 KB
/
latest_posts.liquid
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<div class="news">
{% if site.latest_posts != blank %}
{% assign latest_posts_size = site.posts | size %}
<div
class="table-responsive"
{% if site.latest_posts.scrollable and latest_posts_size > 3 %}
style="max-height: 60vw"
{% endif %}
>
<table class="table table-sm table-borderless">
{% assign latest_posts = site.posts %}
{% if site.latest_posts.limit %}
{% assign latest_posts_limit = site.latest_posts.limit %}
{% else %}
{% assign latest_posts_limit = latest_posts_size %}
{% endif %}
{% for item in latest_posts limit: latest_posts_limit %}
<tr>
<th scope="row" style="width: 20%">{{ item.date | date: '%b %d, %Y' }}</th>
<td>
{% if item.redirect == blank %}
<a class="news-title" href="{{ item.url | relative_url }}">{{ item.title }}</a>
{% elsif item.redirect contains '://' %}
<a class="news-title" href="{{ item.redirect }}" target="_blank">{{ item.title }}</a>
<svg width="2rem" height="2rem" viewBox="0 0 40 40" xmlns="http://www.w3.org/2000/svg">
<path
d="M17 13.5v6H5v-12h6m3-3h6v6m0-6-9 9"
class="icon_svg-stroke"
stroke="#999"
stroke-width="1.5"
fill="none"
fill-rule="evenodd"
stroke-linecap="round"
stroke-linejoin="round"
></path>
</svg>
{% else %}
<a class="news-title" href="{{ item.redirect | relative_url }}">{{ item.title }}</a>
{% endif %}
</td>
</tr>
{% endfor %}
</table>
</div>
{% else %}
<p>No posts so far...</p>
{% endif %}
</div>