-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.njk
45 lines (42 loc) · 1.4 KB
/
index.njk
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
---
layout: base.njk
title: Home
---
<h2 class="command-prompt">> ls -la blog/</h2>
<div class="post-list">
{% if collections.posts.length > 0 %}
{% for post in collections.posts %}
<article class="post-item">
<h2 class="post-title">
<a href="{{ post.url | url }}">{{ post.data.title }}</a>
</h2>
<div class="post-meta">
<time datetime="{{ post.date | dateFormat }}">{{ post.date | dateFormat }}</time>
{% if post.data.tags %}
•
{% for tag in post.data.tags %}
{% if tag != "post" %}
<a href="{{ ('/tags/' + (tag | lowercase) + '/') | url }}" class="tag">{{ tag }}</a>{% if not loop.last %} {% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div>
<div class="post-excerpt">
{% if post.data.excerpt %}
{{ post.data.excerpt }}
{% else %}
{{ post.templateContent | striptags | truncate(150) }}
{% endif %}
</div>
<a href="{{ post.url | url }}" class="read-more">Read more ></a>
</article>
{% endfor %}
{% if collections.posts.length > 5 %}
<div class="pagination">
<a href="{{ '/blog/page-2/' | url }}">next ></a>
</div>
{% endif %}
{% else %}
<p>> echo "No posts found. Create your first post in the blog directory."</p>
{% endif %}
</div>