diff --git a/_data/assets/self_host.yml b/_data/origin/basic.yml similarity index 100% rename from _data/assets/self_host.yml rename to _data/origin/basic.yml diff --git a/_data/assets/cross_origin.yml b/_data/origin/cors.yml similarity index 100% rename from _data/assets/cross_origin.yml rename to _data/origin/cors.yml diff --git a/_includes/head.html b/_includes/head.html index f767edbf1bf..0c85fe13ca4 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -58,15 +58,15 @@ {% include favicons.html %} {% if site.resources.ignore_env != jekyll.environment and site.resources.self_hosted %} - + {% else %} - {% for cdn in site.data.assets[origin].cdns %} + {% for cdn in site.data.origin[type].cdns %} {% endfor %} - + {% endif %} @@ -90,20 +90,20 @@ {% endif %} - + - + {% if site.toc and page.toc %} - + {% endif %} {% if page.layout == 'page' or page.layout == 'post' %} - + {% endif %} @@ -113,5 +113,4 @@ {% endunless %} {% include metadata-hook.html %} - diff --git a/_includes/js-selector.html b/_includes/js-selector.html index 895ccefcf04..177aaf22783 100644 --- a/_includes/js-selector.html +++ b/_includes/js-selector.html @@ -2,11 +2,11 @@ -{% assign urls = site.data.assets[origin].jquery.js +{% assign urls = site.data.origin[type].jquery.js | append: ',' - | append: site.data.assets[origin].bootstrap.js + | append: site.data.origin[type].bootstrap.js | append: ',' - | append: site.data.assets[origin].search.js + | append: site.data.origin[type].search.js %} @@ -14,20 +14,20 @@ {% if page.layout == 'post' %} {% if site.google_analytics.pv.proxy_endpoint or site.google_analytics.pv.cache_path %} - {% assign urls = urls | append: ',' | append: site.data.assets[origin].countup.js %} + {% assign urls = urls | append: ',' | append: site.data.origin[type].countup.js %} {% endif %} {% endif %} {% if page.layout == 'post' or page.layout == 'page' or page.layout == 'home' %} - {% assign urls = urls | append: ',' | append: site.data.assets[origin].lazysizes.js %} + {% assign urls = urls | append: ',' | append: site.data.origin[type].lazysizes.js %} {% unless page.layout == 'home' %} {% assign urls = urls | append: ',' - | append: site.data.assets[origin]['magnific-popup'].js + | append: site.data.origin[type]['magnific-popup'].js | append: ',' - | append: site.data.assets[origin].clipboard.js + | append: site.data.origin[type].clipboard.js %} {% endunless %} {% endif %} @@ -42,37 +42,37 @@ {% assign urls = urls | append: ',' - | append: site.data.assets[origin].dayjs.js.common + | append: site.data.origin[type].dayjs.js.common | append: ',' - | append: site.data.assets[origin].dayjs.js.locale + | append: site.data.origin[type].dayjs.js.locale | replace: ':LOCALE', locale | append: ',' - | append: site.data.assets[origin].dayjs.js.relativeTime + | append: site.data.origin[type].dayjs.js.relativeTime | append: ',' - | append: site.data.assets[origin].dayjs.js.localizedFormat + | append: site.data.origin[type].dayjs.js.localizedFormat %} {% endif %} {% if page.content contains ' {% if page.math %} @@ -94,8 +94,8 @@ } }; - - + + {% endif %} {% if jekyll.environment == 'production' %} diff --git a/_includes/assets-origin.html b/_includes/origin-type.html similarity index 52% rename from _includes/assets-origin.html rename to _includes/origin-type.html index 841e252c8bf..7f72012f783 100644 --- a/_includes/assets-origin.html +++ b/_includes/origin-type.html @@ -1,12 +1,13 @@ -{% comment %} Site static assets origin {% endcomment %} -{% assign origin = 'cross_origin' %} +{% comment %} Site static assets origin type {% endcomment %} + +{% assign type = 'cors' %} {% if site.assets.self_host.enabled %} {% if site.assets.self_host.env %} {% if site.assets.self_host.env == jekyll.environment %} - {% assign origin = 'self_host' %} + {% assign type = 'basic' %} {% endif %} {% else %} - {% assign origin = 'self_host' %} + {% assign type = 'basic' %} {% endif %} {% endif %} diff --git a/_layouts/default.html b/_layouts/default.html index 755c59e13c3..d6ff29c7ef3 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -5,7 +5,7 @@ -{% include assets-origin.html %} +{% include origin-type.html %} {% include lang.html %} diff --git a/_layouts/page.html b/_layouts/page.html index 917a4f453cb..fc2c915417b 100644 --- a/_layouts/page.html +++ b/_layouts/page.html @@ -3,7 +3,7 @@ --- {% include lang.html %} -{% include assets-origin.html %} +{% include origin-type.html %}