diff options
author | pseudorook <pseudorook@protonmail.com> | 2017-10-05 19:02:29 +0300 |
---|---|---|
committer | pseudorook <pseudorook@protonmail.com> | 2017-10-05 19:02:29 +0300 |
commit | a2caea71272e9b94d2fb62f25109927aea27b493 (patch) | |
tree | bc6847bad5948c2b4d99aa6775eaf6a22e0e5ef5 /layouts | |
parent | 90bb36bdc42c814a2f29ce3f27f676763ff4b74e (diff) |
Removing relative prefix and adding base url instead.
Having a base URL and setting relativeURL breaks the template code for
calculating '../'s. Without base URL, the share links won't work.
So, trying full absolute paths instead. Set canonifyURLs=true in the
config.toml.
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/partials/navbar-hero.html | 21 | ||||
-rw-r--r-- | layouts/shortcodes/banner-fluid.html | 21 | ||||
-rw-r--r-- | layouts/shortcodes/banner.html | 21 |
3 files changed, 3 insertions, 60 deletions
diff --git a/layouts/partials/navbar-hero.html b/layouts/partials/navbar-hero.html index b66871a..f63a66a 100644 --- a/layouts/partials/navbar-hero.html +++ b/layouts/partials/navbar-hero.html @@ -40,27 +40,8 @@ </div> <!-- Hero content: will be in the middle --> -{{ $.Scratch.Set "url" ($.Page.Permalink | replaceRE "^//localhost:[0-9]*/" "" | replaceRE "^/" "" | replaceRE "/$" "") -}} -{{ if eq (len ($.Scratch.Get "url")) 0 -}} - {{ $.Scratch.Set "prefix" "." -}} -{{ else -}} - {{ $.Scratch.Set "length" ((split ($.Scratch.Get "url") "/") | len) -}} - {{ if eq ($.Scratch.Get "length") 0 -}} - {{ $.Scratch.Set "prefix" "." -}} - {{ else -}} - {{ $.Scratch.Set "prefix" "" -}} - {{ range $i, $e := (seq ($.Scratch.Get "length")) -}} - {{ if eq (add $i 1) ($.Scratch.Get "length") -}} - {{ $.Scratch.Set "prefix" (print ($.Scratch.Get "prefix") "..") -}} - {{ else -}} - {{ $.Scratch.Set "prefix" (print ($.Scratch.Get "prefix") "../") -}} - {{ end -}} - {{ end -}} - {{ end -}} -{{ end -}} - <div class="hero-body" - style="background:url('{{ $.Scratch.Get "prefix" }}{{ .Site.Data.defaults.icons.banner }}') center; + style="background:url('{{ .Site.BaseURL }}/{{ $.Scratch.Get "prefix" }}{{ .Site.Data.defaults.icons.banner }}') center; background-size: auto 100%;"> </div> diff --git a/layouts/shortcodes/banner-fluid.html b/layouts/shortcodes/banner-fluid.html index 77fd501..40d0a59 100644 --- a/layouts/shortcodes/banner-fluid.html +++ b/layouts/shortcodes/banner-fluid.html @@ -5,27 +5,8 @@ <section class="hero {{ with .Get "class" }}{{.}}{{ end }}"> -{{ $.Scratch.Set "url" ($.Page.Permalink | replaceRE "^//localhost:[0-9]*/" "" | replaceRE "^/" "" | replaceRE "/$" "") -}} -{{ if eq (len ($.Scratch.Get "url")) 0 -}} - {{ $.Scratch.Set "prefix" "." -}} -{{ else -}} - {{ $.Scratch.Set "length" ((split ($.Scratch.Get "url") "/") | len) -}} - {{ if eq ($.Scratch.Get "length") 0 -}} - {{ $.Scratch.Set "prefix" "." -}} - {{ else -}} - {{ $.Scratch.Set "prefix" "" -}} - {{ range $i, $e := (seq ($.Scratch.Get "length")) -}} - {{ if eq (add $i 1) ($.Scratch.Get "length") -}} - {{ $.Scratch.Set "prefix" (print ($.Scratch.Get "prefix") "..") -}} - {{ else -}} - {{ $.Scratch.Set "prefix" (print ($.Scratch.Get "prefix") "../") -}} - {{ end -}} - {{ end -}} - {{ end -}} -{{ end -}} - <div class="hero-body" - style="background:url('{{ with .Get "img" }}{{ $.Scratch.Get "prefix" }}{{.}}{{ end }}') center; + style="background:url('{{ .Site.BaseURL }}/{{ with .Get "img" }}{{ $.Scratch.Get "prefix" }}{{.}}{{ end }}') center; {{- if eq (.Get "mode") "stretch" }}background-size: cover; {{- else if eq (.Get "mode") "repeat" }}background-size: auto 100%; {{- end }}"> diff --git a/layouts/shortcodes/banner.html b/layouts/shortcodes/banner.html index fdb59f1..fcb7e92 100644 --- a/layouts/shortcodes/banner.html +++ b/layouts/shortcodes/banner.html @@ -1,26 +1,7 @@ <section class="hero {{ with .Get "class" }}{{.}}{{ end }}"> -{{ $.Scratch.Set "url" ($.Page.Permalink | replaceRE "^//localhost:[0-9]*/" "" | replaceRE "^/" "" | replaceRE "/$" "") -}} -{{ if eq (len ($.Scratch.Get "url")) 0 -}} - {{ $.Scratch.Set "prefix" "." -}} -{{ else -}} - {{ $.Scratch.Set "length" ((split ($.Scratch.Get "url") "/") | len) -}} - {{ if eq ($.Scratch.Get "length") 0 -}} - {{ $.Scratch.Set "prefix" "." -}} - {{ else -}} - {{ $.Scratch.Set "prefix" "" -}} - {{ range $i, $e := (seq ($.Scratch.Get "length")) -}} - {{ if eq (add $i 1) ($.Scratch.Get "length") -}} - {{ $.Scratch.Set "prefix" (print ($.Scratch.Get "prefix") "..") -}} - {{ else -}} - {{ $.Scratch.Set "prefix" (print ($.Scratch.Get "prefix") "../") -}} - {{ end -}} - {{ end -}} - {{ end -}} -{{ end -}} - <div class="hero-body" - style="background:url('{{ with .Get "img" }}{{ $.Scratch.Get "prefix" }}{{.}}{{ end }}') center; + style="background:url('{{ .Site.BaseURL }}/{{ with .Get "img" }}{{ $.Scratch.Get "prefix" }}{{.}}{{ end }}') center; {{- if eq (.Get "mode") "stretch" }}background-size: cover; {{- else if eq (.Get "mode") "repeat" }}background-size: auto 100%; {{- end }}"> |