1
0
mirror of https://github.com/cotes2020/jekyll-theme-chirpy.git synced 2025-12-18 05:41:31 +00:00

Feature: Add reading time to posts

This commit is contained in:
Cotes Chung
2020-12-17 15:17:21 +08:00
parent 87ba30a393
commit b9ffe15ffb
6 changed files with 66 additions and 24 deletions

View File

@@ -65,9 +65,13 @@ layout: page
<div class="post-meta text-muted">
<!-- posted date -->
<i class="far fa-clock fa-fw"></i>
<i class="far fa-calendar fa-fw"></i>
{% include timeago.html date=post.date tooltip=true %}
<!-- time to read -->
<i class="far fa-clock fa-fw"></i>
<span>{% include read-time.html content=post.content %}</span>
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
<i class="far fa-eye fa-fw"></i>
@@ -75,6 +79,7 @@ layout: page
<i class="fas fa-spinner fa-spin fa-fw"></i>
</span>
{% endif %}
</div>
</div> <!-- .post-review -->

View File

@@ -18,33 +18,31 @@ layout: default
<div class="post-meta text-muted d-flex flex-column">
<!-- Published date and author -->
<div>
Posted
{% include timeago.html date=page.date tooltip=true %}
by
<span class="author">
{% if page.author %}
{{ page.author }}
{% else %}
{{ site.author }}
{% endif %}
{{ page.author | default: site.author }}
</span>
</div>
<!-- lastmod -->
{% if page.last_modified_at %}
<div>
Updated
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
</div>
{% endif %}
<!-- lastmod -->
{% if page.last_modified_at %}
<span>
Updated
{% include timeago.html date=page.last_modified_at class="lastmod" tooltip=true %}
</span>
{% endif %}
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
<div>
<!-- read time -->
{% include read-time.html content=content %}
<!-- page views -->
{% if site.google_analytics.pv.enabled %}
<span id="pv" class="pageviews"><i class="fas fa-spinner fa-spin fa-fw"></i></span>
views
{% endif %}
</div>
{% endif %}
</div> <!-- .post-meta -->