perf: avoid post pageviews from shifting while loading

This commit is contained in:
Cotes Chung 2022-04-26 01:43:40 +08:00
parent 6d35f5f8da
commit 135a16f13e
No known key found for this signature in database
GPG key ID: 0D9E54843167A808

View file

@ -35,28 +35,6 @@ tail_includes:
<div class="post-meta text-muted"> <div class="post-meta text-muted">
<!-- author -->
<div>
{% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %}
{% assign author_link = nil %}
{% if page.author %}
{% assign author_link = site.data.authors[page.author].url %}
{% elsif author_name == site.social.name %}
{% assign author_link = site.social.links[0] %}
{% endif %}
{{ site.data.locales[lang].post.written_by }}
<em>
{% if author_link %}
<a href="{{ author_link }}">{{ author_name }}</a>
{% else %}
{{ author_name }}
{% endif %}
</em>
</div>
<div class="d-flex">
<div> <div>
<!-- published date --> <!-- published date -->
<span> <span>
@ -71,10 +49,32 @@ tail_includes:
{% include datetime.html date=page.last_modified_at tooltip=true %} {% include datetime.html date=page.last_modified_at tooltip=true %}
</span> </span>
{% endif %} {% endif %}
</div>
<!-- read time --> <div class="d-flex justify-content-between">
{% include read-time.html content=content prompt=true %} <!-- author -->
<span>
{% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %}
{% assign author_link = nil %}
{% if page.author %}
{% assign author_link = site.data.authors[page.author].url %}
{% elsif author_name == site.social.name %}
{% assign author_link = site.social.links[0] %}
{% endif %}
{{ site.data.locales[lang].post.written_by }}
<em>
{% if author_link %}
<a href="{{ author_link }}">{{ author_name }}</a>
{% else %}
{{ author_name }}
{% endif %}
</em>
</span>
<div>
<!-- page views --> <!-- page views -->
{% 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 %}
<span> <span>
@ -84,6 +84,9 @@ tail_includes:
{{ site.data.locales[lang].post.pageview_measure }} {{ site.data.locales[lang].post.pageview_measure }}
</span> </span>
{% endif %} {% endif %}
<!-- read time -->
{% include read-time.html content=content prompt=true %}
</div> </div>
</div> <!-- .d-flex --> </div> <!-- .d-flex -->