From 135a16f13ee783d9308669ff9a824847a73c951c Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 26 Apr 2022 01:43:40 +0800 Subject: [PATCH] perf: avoid post pageviews from shifting while loading --- _layouts/post.html | 65 ++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 31 deletions(-) diff --git a/_layouts/post.html b/_layouts/post.html index 91d0a00..a1e4f48 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -35,46 +35,46 @@ tail_includes:
-
- {% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %} - {% assign author_link = nil %} + + + {{ site.data.locales[lang].post.posted }} + {% include datetime.html date=page.date tooltip=true %} + - {% 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] %} + + {% if page.last_modified_at %} + + {{ site.data.locales[lang].post.updated }} + {% include datetime.html date=page.last_modified_at tooltip=true %} + {% endif %} - - {{ site.data.locales[lang].post.written_by }} - - {% if author_link %} - {{ author_name }} - {% else %} - {{ author_name }} - {% endif %} -
-
-
- - - {{ site.data.locales[lang].post.posted }} - {% include datetime.html date=page.date tooltip=true %} - +
+ + + {% capture author_name %}{{ site.data.authors[page.author].name | default: site.social.name }}{% endcapture %} + {% assign author_link = nil %} - - {% if page.last_modified_at %} - - {{ site.data.locales[lang].post.updated }} - {% include datetime.html date=page.last_modified_at tooltip=true %} - + {% 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 %} - - {% include read-time.html content=content prompt=true %} + {{ site.data.locales[lang].post.written_by }} + + {% if author_link %} + {{ author_name }} + {% else %} + {{ author_name }} + {% endif %} + + + +
{% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} @@ -84,6 +84,9 @@ tail_includes: {{ site.data.locales[lang].post.pageview_measure }} {% endif %} + + + {% include read-time.html content=content prompt=true %}