From bec924ed4c69f9cbe4b3a46fe6f333be728fac10 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 25 Nov 2019 20:56:50 +0800 Subject: [PATCH] Optimize performance. --- _config.yml | 6 ++-- _includes/head.html | 33 +++++++++++++----- _layouts/default.html | 11 +++--- _layouts/page.html | 29 ++++++++-------- _layouts/post.html | 81 +++++++++++++++++++++++-------------------- assets/css/main.scss | 31 ++++++++++------- assets/css/post.scss | 31 +++++++++++++++++ 7 files changed, 142 insertions(+), 80 deletions(-) diff --git a/_config.yml b/_config.yml index 02d872e..59b7dce 100644 --- a/_config.yml +++ b/_config.yml @@ -42,11 +42,13 @@ google_site_verification: google_meta_tag_verification # change to your verifica timezone: Asia/Shanghai google_analytics: - # Change to your Google Analytics ID - id: 'UA-*********-*' + # Fill with your Google Analytics ID + id: '' # The Google Analytics pageviews switch. # DO NOT enable it unless you know how to deploy the Google Analytics superProxy. pv: false + # superProxy Url, only valid when `google_analytics.pv` is set to 'true' + proxy_url: '' disqus: shortname: 'disqus' # Change to your Disqus shortname. diff --git a/_includes/head.html b/_includes/head.html index dc80e12..984de23 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -19,6 +19,27 @@ {% include favicons.html %} + + + + + + {% if jekyll.environment == 'production' %} + + + + + + + {% if site.google_analytics.proxy_url and site.google_analytics.pv %} + + + {% endif %} + {% endif %} + + + + @@ -55,25 +76,21 @@ integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"> + integrity="sha256-fTuUgtT7O2rqoImwjrhDgbXTKUwyxxujIMRIK7TbuNU=" crossorigin="anonymous" async> + integrity="sha256-5+02zu5UULQkO7w1GIr6vftCgMfFdZcAHeDtFnKZsBs=" crossorigin="anonymous" async> - {% if jekyll.environment == 'production' %} - {% include google-analytics.html %} - {% endif %} - {% if page.layout == 'home' or page.layout == 'post' %} - + {% if site.google_analytics.pv %} diff --git a/_layouts/default.html b/_layouts/default.html index 1cf913e..e59504a 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -17,7 +17,6 @@ layout: compress
{% include topbar.html %}
-
{% capture _content %} {{ content }} @@ -26,7 +25,6 @@ layout: compress {% include fixlinenos.html %} {{ _content }} -
{% include footer.html %}
{% include search-results.html %} @@ -34,11 +32,16 @@ layout: compress
- {% include search.html %} - + + {% if jekyll.environment == 'production' %} + {% include google-analytics.html %} + {% endif %} + + {% include search.html %} + \ No newline at end of file diff --git a/_layouts/page.html b/_layouts/page.html index c68eb70..47ec8ba 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -5,23 +5,22 @@ layout: default # MIT License --- -
-
- - {% if page.dynamic_title %} - -

{{ page.title }}

-
+
+
+
+ {% if page.dynamic_title %} +

{{ page.title }}

+
+ {{ content }} +
+ {% else %} {{ content }} -
+ {% endif %} - {% else %} +
- {{ content }} +
- {% endif %} + {% include panel.html %} -
-
- -{% include panel.html %} +
diff --git a/_layouts/post.html b/_layouts/post.html index e1f9ea9..27f7a6f 100644 --- a/_layouts/post.html +++ b/_layouts/post.html @@ -5,11 +5,11 @@ layout: default # MIT Licensed --- -{% include date-format.html %} +
+ {% include date-format.html %} -
-
-
+
+

{{ page.title }}

+ {% if page.seo.date_modified > page.date %}
@@ -34,12 +35,14 @@ layout: default
{% endif %} + {% if site.google_analytics.pv %}
views
{% endif %} +
{% capture post_content %} @@ -68,44 +71,46 @@ layout: default {{- tag -}} {%- if forloop.last != true -%} {%- endif -%} {% endfor %} -
+
{% endif %} -
+
+ + {% include related-posts.html %} + +
+ {% if page.previous.url %} + + {% else %} + + {% endif %} + + OLDER POST + + + {% if page.next.url %} + + {% else %} + + {% endif %} + NEWER POST + + +
+
- {% include related-posts.html %} - -
- {% if page.previous.url %} - - {% else %} - - {% endif %} - - OLDER POST - - - {% if page.next.url %} - - {% else %} - - {% endif %} - NEWER POST - - -
+ {% include panel.html %} +
+
{% if site.disqus.comments and page.comments %} {% include disqus.html %} - {% else %} -
{% endif %} +
+
- - - -{% include panel.html %} +