/
index.njk
98 lines (95 loc) · 4.29 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
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
{% extends "_layout.njk" %}
{% block css %}
<link rel="stylesheet" type="text/css" href="{{ url_for("css/page.css") }}">
<link rel="stylesheet" type="text/css" href="{{ url_for("css/post.css") }}">
{% endblock %}
{% block title %}{{ config.title }}{% if config.subtitle %} - {{ config.subtitle }}{% endif %}{% endblock %}
{% block content %}
{% set comment = false %}
<div id="index" class="index page">
{% for post in page.posts.toArray() %}
<article class="article post card{% if theme.animate %} animate{% endif %}" itemscope itemtype="http://schema.org/Article">
<div class="post-block">
<link itemprop="mainEntityOfPage" href="{{ config.url }}{{ url_for(post.path) }}">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="{{ config.author }}">
<meta itemprop="description" content="{{ config.description }}">
<meta itemprop="image" content="{{ url_for( theme.avatar) }}">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="{{ config.title }}">
</span>
</div>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
<a class="post-title-link post-title-link-external" href="{{ url_for(post.path) }}" itemprop="url">{{ post.title }}</a>
</h1>
<div class="post-meta">
{% if post.date %}
<span class="post-date">
<i class="far fa-calendar-plus"></i><span><time title="post-date" itemprop="dateCreated datePublished" datetime="{{ moment(post.date).format() }}">{{ date(post.date, config.date_format) }} {{ time(post.date, config.time_format) }}</time></span>
</span>
{% endif %}
{% if post.categories and post.categories.toArray().length %}
{% if post.date %}
<span class="post-meta-divider divider">|</span>
{% endif %}
<span class="post-categories">
{# About `-`: https://mozilla.github.io/nunjucks/cn/templating.html#part-861ece9d8e5ce60c #}
{% for cat in post.categories.toArray() -%}
{% if loop.first %}<i class="far fa-folder-open"></i>{% else %}<i class="fas fa-angle-right"></i>{% endif %}<span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="{{ url_for(cat.path) }}" itemprop="url" rel="index"><span itemprop="name">{{ cat.name }}</span></a></span>
{%- endfor %}
</span>
{% endif %}
{% if post.comment !== false and theme.comment.enable %}
{% if theme.comment.disqus_shortname %}
{% if post.categories or post.date %}
<span class="post-meta-divider divider">|</span>
{% endif %}
<span class="post-comment-count">
<i class="far fa-comments"></i><span><a href="{{ url_for(post.path) }}#disqus_thread" itemprop="discussionUrl"><span class="post-comment-count disqus-comment-count" data-disqus-identifier="{{ post.path }}" itemprop="commentCount"></span></a></span>
</span>
{% endif %}
{% endif %}
</div>
</header>
<main class="post-main" itemprop="articleBody">
{% if post.excerpt %}
{{ post.excerpt }}
{% elif post.description %}
{{ post.description }}
{% elif theme.auto_excerpt %}
{% set st_content = post.content | striptags %}
{{ st_content.substring(0, theme.auto_excerpt) }}
{% else %}
{{ post.content }}
{% endif %}
</main>
<footer class="post-footer">
{% if post.tags and post.tags.toArray().length %}
<div class="post-tags">
{% for tag in post.tags.toArray() %}
<a class="post-tag button" href="{{ url_for(tag.path) }}" rel="tag"><i class="fas fa-tags"></i>{{ tag.name }}</a>
{% endfor %}
</div>
{% endif %}
</footer>
</article>
{% endfor %}
{% if page.prev or page.next %}
<nav class="pagination">
{{
paginator({
prev_text: "<i class=\"fas fa-angle-left\" aria-label=\"" + __("accessibility.prev_page") + "\"></i>",
next_text: "<i class=\"fas fa-angle-right\" aria-label=\"" + __("accessibility.next_page") + "\"></i>",
mid_size: 1,
escape: false
})
}}
</nav>
{% endif %}
{% if theme.comment.enable %}
{% include "comment.njk" %}
{% endif %}
</div>
{% endblock %}