From 7b43e4061dd795cb3be91b47f828ea6d72cd7dcf Mon Sep 17 00:00:00 2001 From: Abel Cheung Date: Sat, 8 Jun 2019 13:34:33 +0800 Subject: [PATCH] Fix showing background img with non-empty baseurl (#497) * Fix showing background img with non-empty baseurl Also switch globally to relative_url for all baseurl prepends, which is more robust than custom URL mangling * More site.baseurl -> relative_url conversion --- 404.html | 2 +- _data/SocialNetworks.yml | 2 +- _includes/footer-scripts.html | 6 +++--- _includes/footer.html | 2 +- _includes/head.html | 8 ++++---- _includes/header.html | 4 ++-- _includes/nav.html | 4 ++-- _includes/navbarlink.html | 2 +- _includes/staticman-script.html | 2 +- _layouts/post.html | 6 +++--- css/main.css | 6 +++--- index.html | 12 ++++++------ 12 files changed, 28 insertions(+), 28 deletions(-) diff --git a/404.html b/404.html index 012e153..432a7a2 100644 --- a/404.html +++ b/404.html @@ -9,5 +9,5 @@ permalink: /404.html

Move along. (404 error)


- + diff --git a/_data/SocialNetworks.yml b/_data/SocialNetworks.yml index 9aa4d84..f8d17c7 100644 --- a/_data/SocialNetworks.yml +++ b/_data/SocialNetworks.yml @@ -73,7 +73,7 @@ telephone: rss: name: "RSS" - baseURL: "{{ '/feed.xml' | prepend: site.baseurl }}" + baseURL: "{{ '/feed.xml' | relative_url }}" icon: "fa-rss" steam: diff --git a/_includes/footer-scripts.html b/_includes/footer-scripts.html index 537e9cc..9515539 100644 --- a/_includes/footer-scripts.html +++ b/_includes/footer-scripts.html @@ -12,7 +12,7 @@ {% if page.js %} {% for js in page.js %} - + {% endfor %} {% endif %} @@ -22,11 +22,11 @@ {% if js contains 'jquery' %} {% else %} - + {% endif %} {% endfor %} {% endif %} diff --git a/_includes/footer.html b/_includes/footer.html index 480c292..b942456 100644 --- a/_includes/footer.html +++ b/_includes/footer.html @@ -8,7 +8,7 @@ {%- assign element = site.data.SocialNetworks[curkey] -%}
  • {%- if curkey == 'rss' -%} - + {%- elsif curkey == 'yelp' -%} {%- else -%} diff --git a/_includes/head.html b/_includes/head.html index 1242dd0..ab8e025 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -11,7 +11,7 @@ {% endif %} - + {% include gtag.html %} {% include gtm_head.html %} @@ -25,7 +25,7 @@ {% if layout.common-css %} {% for css in layout.common-css %} - + {% endfor %} {% endif %} @@ -43,7 +43,7 @@ {% if page.css %} {% for css in page.css %} - + {% endfor %} {% endif %} @@ -125,7 +125,7 @@ {% if page.comments and site.staticman.repository and site.staticman.branch %} - + {% endif %} diff --git a/_includes/header.html b/_includes/header.html index dc6220d..1fea242 100644 --- a/_includes/header.html +++ b/_includes/header.html @@ -8,10 +8,10 @@ {% assign imgnum = forloop.index %} {% for imginfo in bigimg %} {% if imginfo[0] %} - data-img-src-{{ imgnum }}="{{ imginfo[0] | prepend: site.baseurl | replace: '//', '/' }}" + data-img-src-{{ imgnum }}="{{ imginfo[0] | relative_url }}" data-img-desc-{{ imgnum }}="{{ imginfo[1] }}" {% else %} - data-img-src-{{ imgnum }}="{{ imginfo | prepend: site.baseurl | replace: '//', '/' }}" + data-img-src-{{ imgnum }}="{{ imginfo | relative_url }}" {% endif %} {% endfor %} {% endfor %} diff --git a/_includes/nav.html b/_includes/nav.html index b1b1388..42dc909 100644 --- a/_includes/nav.html +++ b/_includes/nav.html @@ -41,7 +41,7 @@ @@ -49,7 +49,7 @@ diff --git a/_includes/navbarlink.html b/_includes/navbarlink.html index f264618..d8005e6 100644 --- a/_includes/navbarlink.html +++ b/_includes/navbarlink.html @@ -8,7 +8,7 @@ {% endif %} {% if internal %} - {% capture linkurl %}{{ site.baseurl }}/{{ include.link[1] }}{% endcapture %} + {% capture linkurl %}{{ include.link[1] | relative_url }}{% endcapture %} {% else %} {% capture linkurl %}{{ include.link[1] }}{% endcapture %} {% endif %} diff --git a/_includes/staticman-script.html b/_includes/staticman-script.html index d71da44..4beea11 100644 --- a/_includes/staticman-script.html +++ b/_includes/staticman-script.html @@ -2,7 +2,7 @@