Skip to content

Commit ce894e8

Browse files
committed
Display word counts on post list as well
1 parent 28f09f2 commit ce894e8

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
1+
{% from "components/node_date_and_word_count.jinja" import node_date_and_word_count %}
2+
13
<div class="article-in-list">
24
<div class="flow flow-first-child">
35
<h2 style="view-transition-name: {{ vt_name(entry, "title") }};">
46
<a href="{{ entry.url }}"> {{ entry.title }} </a>
57
</h2>
6-
{% if entry.date %}
7-
<div class="fs-2 ff-mono">
8-
<time
9-
style="view-transition-name: {{ vt_name(entry, "date") }};"
10-
datetime="{{ entry.date }}"
11-
>
12-
{{ entry.date.strftime('%d %B %Y') }}
13-
</time>
14-
</div>
15-
{% endif %}
8+
{{ node_date_and_word_count(entry) }}
169
</div>
1710
</div>

lib/meteor/templates/components/node_date_and_word_count.jinja

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
{% from "components/vt_name.jinja" import vt_name %}
22

33
{% macro node_date_and_word_count(node) -%}
4-
{% if node.date %}
4+
{% if node.date or node.word_count and not node.is_dir_index and not node.is_homepage_index and not node.title == "About" %}
55
<div class="node-date-and-word-count">
6-
<time
7-
style="view-transition-name: {{ vt_name(node, "date") }};"
8-
datetime="{{ node.date }}"
9-
>
10-
{{ node.date.strftime('%d %B %Y') }}
11-
</time>
6+
{% if node.date %}
7+
<time
8+
style="view-transition-name: {{ vt_name(node, "date") }};"
9+
datetime="{{ node.date }}"
10+
>
11+
{{ node.date.strftime('%d %B %Y') }}
12+
</time>
13+
{% endif %}
1214
{% if node.word_count %}
1315
<span class="word-count">{{ node.word_count }} words</span>
1416
{% endif %}

0 commit comments

Comments
 (0)