diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 4d61d7c75..9acb5cbf3 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -20,12 +20,14 @@ module.exports = (grunt) -> grunt.initConfig config: cfg: grunt.file.readYAML("_config.yml") + cfg_dev: grunt.file.readYAML("_config.dev.yml") pkg: grunt.file.readJSON("package.json") amsf: grunt.file.readYAML("_amsf.yml") deploy: grunt.file.readYAML("_deploy.yml") app: "<%= config.cfg.source %>" dist: "<%= config.cfg.destination %>" - base: "<%= config.cfg.base %>" + base: "<%= config.cfg.baseurl %>" + base_dev: "<%= config.cfg_dev.baseurl %>" assets: "<%= config.cfg.assets %>" banner: "\n" @@ -317,6 +319,7 @@ module.exports = (grunt) -> serve: options: config: "_config.yml,_amsf.yml,<%= config.app %>/_data/<%= amsf.theme.current %>.yml,_config.dev.yml" + dest: "<%= config.dist %><%= config.base_dev %>" drafts: true future: true diff --git a/_app/_includes/_amsf.html b/_app/_includes/_amsf.html index 6f7e43d5a..6bfb187d2 100644 --- a/_app/_includes/_amsf.html +++ b/_app/_includes/_amsf.html @@ -51,23 +51,25 @@ {% comment %} Site base URL + + Deprecated, it's now the same as the Jekyll built-in filter `absolute_url`. {% endcomment %} -{% capture amsf_site_base %}{{ site.base | prepend: site.url }}{% endcapture %} +{% capture amsf_site_base %}{{ "" | absolute_url }}{% endcapture %} {% comment %} Theme base URL {% endcomment %} -{% capture amsf_theme_base %}{{ site.amsf_theme | prepend: '/themes/' }}{% endcapture %} +{% capture amsf_theme_base %}{{ site.amsf_theme | prepend: "/themes/" }}{% endcapture %} {% comment %} Theme assets base URL {% endcomment %} -{% capture amsf_theme_assets %}{{ site.amsf_theme | prepend: '/themes/' | prepend: site.assets | prepend: site.base }}{% endcapture %} +{% capture amsf_theme_assets %}{{ amsf_theme_base | prepend: site.assets | relative_url }}{% endcapture %} {% comment %} User assets base URL {% endcomment %} -{% capture amsf_user_assets %}{{ site.assets | prepend: site.base }}{% endcapture %} +{% capture amsf_user_assets %}{{ site.assets | relative_url }}{% endcapture %} {% comment %} Page theme color @@ -119,10 +121,10 @@ @since 1.1.0 {% endcomment %} -{% capture amsf_favicon_png %}{{ "/favicon.png" | prepend: site.base }}{% endcapture %} -{% capture amsf_favicon_svg %}{{ "/favicon.svg?assets-inline-assets-keep" | prepend: site.base }}{% endcapture %} -{% capture amsf_mask_icon %}{{ "/mask-icon.svg" | prepend: site.base }}{% endcapture %} -{% capture amsf_apple_touch_icon %}{{ "/apple-touch-icon.png" | prepend: site.base }}{% endcapture %} +{% capture amsf_favicon_png %}{{ "/favicon.png" | relative_url }}{% endcapture %} +{% capture amsf_favicon_svg %}{{ "/favicon.svg?assets-inline-assets-keep" | relative_url }}{% endcapture %} +{% capture amsf_mask_icon %}{{ "/mask-icon.svg" | relative_url }}{% endcapture %} +{% capture amsf_apple_touch_icon %}{{ "/apple-touch-icon.png" | relative_url }}{% endcapture %} {% capture amsf_favicons %} {% for static_file in site.static_files %} @@ -154,7 +156,7 @@ {% comment %} Feed URL {% endcomment %} -{% capture amsf_feed_url %}{{ site.feed | prepend: site.base | replace: '/index.xml', '/' }}{% endcapture %} +{% capture amsf_feed_url %}{{ site.feed | relative_url | replace: '/index.xml', '/' }}{% endcapture %} {% comment %} Page title @@ -162,9 +164,9 @@ {% capture amsf_page_title %}{{ page.title | strip_html | xml_escape }}{% endcapture %} {% comment %} - Page URL + Page URL (full URl with `site.url`) {% endcomment %} -{% capture amsf_page_url %}{{ page.url | prepend: amsf_site_base | replace: '/index.html', '/' | replace: '/index.htm', '/' | replace: '/index.xml', '/' }}{% endcapture %} +{% capture amsf_page_url %}{{ page.url | absolute_url | replace: '/index.html', '/' | replace: '/index.htm', '/' | replace: '/index.xml', '/' }}{% endcapture %} {% comment %} Page publish date @@ -305,7 +307,7 @@ @since 1.1.0 {% endcomment %} -{% assign amsf_site_logo = "/logo.png" | prepend: amsf_site_base %} +{% assign amsf_site_logo = "/logo.png" | absolute_url %} {% capture amsf_page_first_image %} {% assign hero_image = page.content | match_regex: ' if ('serviceWorker' in navigator && window.location.hostname === '{{ amsf_hostname }}') { - navigator.serviceWorker.register('{{ "/service-worker.js" | prepend: site.base }}').then(function (registration) { + navigator.serviceWorker.register('{{ "/service-worker.js" | relative_url }}').then(function (registration) { console.log('ServiceWorker registration successful with scope: ', registration.scope); }).catch(function(err) { console.log('ServiceWorker registration failed: ', err); diff --git a/_app/_includes/themes/curtana/includes/footer.html b/_app/_includes/themes/curtana/includes/footer.html index 669b813ce..f723c73c1 100644 --- a/_app/_includes/themes/curtana/includes/footer.html +++ b/_app/_includes/themes/curtana/includes/footer.html @@ -3,7 +3,7 @@ {% else %}