-
Notifications
You must be signed in to change notification settings - Fork 663
/
Copy pathpost-card.html
55 lines (53 loc) · 2.67 KB
/
post-card.html
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
49
50
51
52
53
54
55
{% assign words_per_minute = site.words_per_minute | default: 200 %}
{% for post in paginator.posts %}
<article class="post-card {{ page.class }}{% unless post.cover %} no-image{% endunless %}">
{% if post.cover %}
<a class="post-card-image-link" href="{{ site.baseurl }}{{ post.url | remove_first: '/' }}">
<div class="post-card-image" style="background-image: url({{ site.baseurl }}{{ post.cover }})"></div>
</a>
{% endif %}
<div class="post-card-content">
<a class="post-card-content-link" href="{{ site.baseurl }}{{ post.url | remove_first: '/' }}">
<header class="post-card-header">
{% if post.tags.size > 0 %}
{% for tag in post.tags %}
{% if forloop.index == post.tags.size %}
<span class="post-card-tags">{{ tag | capitalize }}</span>
{% else %}
<span class="post-card-tags">{{ tag | capitalize }}</span>
{% endif %}
{% endfor %}
{% endif %}
<h2 class="post-card-title">{{ post.title }}</h2>
</header>
<section class="post-card-excerpt">
{% if post.excerpt %}
<p>{{ post.excerpt | strip_html | truncatewords: 33, "" }}</p>
{% else %}
<p>{{ post.content | strip_html | truncatewords: 33, "" }}</p>
{% endif %}
</section>
</a>
<footer class="post-card-meta">
{% for author in site.data.authors %}
{% if author[1].username == post.author %}
{% if author[1].picture %}
<img class="author-profile-image" src="{{ site.baseurl }}{{ author[1].picture }}" alt="{{ author[1].name }}" />
{% endif %}
<span class="post-card-author">
<a href="{{ site.baseurl }}author/{{ post.author }}/">{{ author[1].name }}</a>
</span>
{% endif %}
{% endfor %}
<span class="reading-time">
{% assign words = post.content | strip_html | number_of_words %}
{% if words <= words_per_minute %}
1 min read
{% else %}
{{ words | divided_by:words_per_minute }} min read
{% endif %}
</span>
</footer>
</div>
</article>
{% endfor %}