Replace the pageviews with categories on home page

This commit is contained in:
Cotes Chung 2021-12-03 20:50:12 +08:00
parent 57feaa660e
commit 6220d09ffb
2 changed files with 11 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<!-- layout specified --> <!-- layout specified -->
{% if page.layout == 'home' or page.layout == 'post' %} {% if page.layout == 'post' %}
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %}
<!-- pv-report needs countup.js --> <!-- pv-report needs countup.js -->
<script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script> <script async src="https://cdn.jsdelivr.net/npm/countup.js@1.9.3/dist/countUp.min.js"></script>

View File

@ -68,13 +68,17 @@ layout: page
<i class="far fa-clock fa-fw"></i> <i class="far fa-clock fa-fw"></i>
{% include read-time.html content=post.content %} {% include read-time.html content=post.content %}
<!-- page views --> <!-- categories -->
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} {% if post.categories.size > 0 %}
<i class="far fa-eye fa-fw"></i> <i class="far fa-folder-open fa-fw"></i>
<span id="pv_{{-post.title-}}" class="pageviews"> <span>
<i class="fas fa-spinner fa-spin fa-fw"></i> {% for category in post.categories %}
</span> {{ category }}
{%- unless forloop.last -%},{%- endunless -%}
{% endfor %}
</span>
{% endif %} {% endif %}
</div> </div>
{% if post.pin %} {% if post.pin %}