generated from greenelab/lab-website-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost-excerpt.html
60 lines (55 loc) · 1.42 KB
/
post-excerpt.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
{% if include.lookup %}
{% assign post = site.posts
| where_exp: "post", "post.slug == include.lookup"
| first
| default: include
%}
{% else %}
{% assign post = include %}
{% endif %}
<div class="post-excerpt-container">
<div class="post-excerpt">
{% assign url = post.url %}
{% assign title = post.title %}
{% assign image = post.image %}
{% if image %}
<a
href="{{ url | relative_url }}"
class="post-excerpt-image"
aria-label="{{ title | default: "excerpt link" }}"
>
<img
src="{{ image | relative_url }}"
alt="{{ title | default: "excerpt image" }}"
loading="lazy"
{% include fallback.html %}
>
</a>
{% endif %}
<div class="post-excerpt-text">
<a href="{{ url | relative_url }}">{{ title }}</a>
{%
include post-info.html
author=post.author
published=post.date
updated=post.last_modified_at
tags=post.tags
%}
{% assign excerpt = post.content
| default: ""
| regex_scan: "<!-- excerpt start -->(.*)<!-- excerpt end -->", true
| default: post.excerpt
| default: ""
| strip_html
%}
{% assign search = post.content
| strip_html
| strip_newlines
| regex_strip
%}
<p data-search="{{ search }}">
{{ excerpt }}
</p>
</div>
</div>
</div>