forked from compiler-research/compiler-research.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog-post-card.html
113 lines (100 loc) · 2.38 KB
/
blog-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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<div class="well">
<div class="post-content">
<h3>{{ post.title }}</h3>
<p>
{% if post.author %}
{% for author_name in post.author %}
{% assign author = site.data.contributors | where: "name", author_name | first %}
{% if author %}
<a href="{{ author.name | replace: " ", "" | prepend: "/team/" }}">
<img
src="{% if author.photo %}{{ site.baseurl }}/images/team/{{ author.photo }}{% else %}{{ site.baseurl }}/images/team/defaultDP.png{% endif %}"
alt="{{ author.name }}" class="author-image" />
{{ author.name }}
</a>
{% if forloop.last == false %}, {% endif %}
{% else %}
{{ author_name }}
{% endif %}
{% endfor %}
{% endif %}
<span class="text-muted">
• {{ post.date | date: "%b %d, %Y" }} • {{ post.content | number_of_words | divided_by: 200 | ceil }} min read
</span>
</p>
<p>{{ post.excerpt | truncatewords: 50 }}</p>
{% if post.tags and post.tags.size > 0 %}
<p>
{% for tag in post.tags %}
<a href="{{ site.baseurl }}/tags#{{ tag | downcase | slugify }}" class="badge">{{ tag }}</a>
{% endfor %}
</p>
{% endif %}
<p>
<button class="btn btn-primary" onclick="window.location.href='{{ post.url }}'">Read More</button>
</p>
</div>
{% if post.banner_image %}
<div class="thumbnail-container">
<img
src="{{ post.banner_image }}"
alt="Post Thumbnail"
class="thumbnail-image"
/>
</div>
{% endif %}
</div>
<style>
.well {
display: flex;
align-items: center;
justify-content: space-between;
flex-wrap: wrap;
}
.post-content {
flex: 1;
min-width: 250px;
margin-bottom: 1rem;
}
.author-image {
width: 30px;
height: 30px;
border-radius: 50%;
object-fit: cover;
margin: 0;
margin-top: 4px;
margin-bottom: 4px;
}
.badge {
background-color: #999999;
padding: 0.5rem;
}
.thumbnail-container {
margin-left: 1rem;
flex-shrink: 0;
min-width: 100px;
}
.thumbnail-image {
width: 200px;
height: 200px;
object-fit: cover;
border-radius: 5px;
}
@media (max-width: 700px) {
.well {
flex-direction: column-reverse;
align-items: flex-start;
}
.well > div {
margin-left: 0;
margin-bottom: 1rem;
}
.well img {
margin-bottom: 1rem;
}
.thumbnail-image {
width: 100%;
height: auto;
}
}
</style>