-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathpost.html
32 lines (32 loc) · 1.26 KB
/
post.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
{% if include.post %}
{% assign post = include.post %}
{% assign image = "/logo_background.png" | prepend: site.env.CSHPUBSITE_ASSETS_URL %}
{% if post.image %}
{% assign image = post.image | prepend: site.env.CSHPUBSITE_ASSETS_URL %}
{% else %}
{% assign hash = post.title | md5 | regex_replace: '[^\d]', '' %}
{% endif %}
<div class="col-xs-12 col-md-6">
<a href="{{ post.url }}">
<div class="card">
<div class="card-header h-25">
{{ post.title }}
</div>
<!-- "Random" background color based on a hash of the title text for posts without images-->
<div
class="card-body"
style="{% if hash %}background-color: hsl({{ hash | modulo: 255 }}, 69%, 69%); {% else %}background-color:#b0197e; {% endif %}background-image: url({{ image }});">
</div>
</div>
</a>
</div>
{% else %}
<div class="col-xs-12 col-md-6">
<div class="card">
<div class="card-header h-25">
No post provided.
</div>
<div class="card-body" style="background-color: #b0197e; background-image: url('{{site.env.CSHPUBSITE_ASSETS_URL}}/logo_background.png');"> </div>
</div>
</div>
{% endif %}