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,46 +35,46 @@ tail_includes:
<div class="post-meta text-muted"> <div class="post-meta text-muted">
<!-- author -->
<div> <div>
{% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %} <!-- published date -->
{% assign author_link = nil %} <span>
{{ site.data.locales[lang].post.posted }}
{% include datetime.html date=page.date tooltip=true %}
</span>
{% if page.author %} <!-- lastmod date -->
{% assign author_link = site.data.authors[page.author].url %} {% if page.last_modified_at %}
{% elsif author_name == site.social.name %} <span>
{% assign author_link = site.social.links[0] %} {{ site.data.locales[lang].post.updated }}
{% include datetime.html date=page.last_modified_at tooltip=true %}
</span>
{% endif %} {% 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>
<div class="d-flex"> <div class="d-flex justify-content-between">
<div> <!-- author -->
<!-- published date --> <span>
<span> {% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %}
{{ site.data.locales[lang].post.posted }} {% assign author_link = nil %}
{% include datetime.html date=page.date tooltip=true %}
</span>
<!-- lastmod date --> {% if page.author %}
{% if page.last_modified_at %} {% assign author_link = site.data.authors[page.author].url %}
<span> {% elsif author_name == site.social.name %}
{{ site.data.locales[lang].post.updated }} {% assign author_link = site.social.links[0] %}
{% include datetime.html date=page.last_modified_at tooltip=true %}
</span>
{% endif %} {% endif %}
<!-- read time --> {{ site.data.locales[lang].post.written_by }}
{% include read-time.html content=content prompt=true %}
<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 -->