diff options
author | Marco A. Harrendorf <marco.harrendorf@cern.ch> | 2017-10-30 20:49:10 +0300 |
---|---|---|
committer | Patrick Collins <thepatrickcollins@gmail.com> | 2017-10-30 20:49:10 +0300 |
commit | 61b7f6f379cfd60b5b41acf3216472e3167fb45c (patch) | |
tree | ac3e70c1d541e42e6f946b4a706dcb23184c5803 | |
parent | 8c44491a5d5a16d2afaec393f5f620fe487a749d (diff) |
Fix: relURL missing / Issue #22 (#73)
* Feature: Adding relURL, so that a website laying in a subfolder is also shown properly
fixing issue #22 further
* Change example site baseurl
-rw-r--r-- | exampleSite/config.toml | 2 | ||||
-rw-r--r-- | layouts/partials/favicon.html | 28 | ||||
-rw-r--r-- | layouts/partials/navbar.html | 6 | ||||
-rw-r--r-- | layouts/partials/sidebar.html | 6 | ||||
-rw-r--r-- | layouts/post/featured.html | 2 | ||||
-rw-r--r-- | layouts/taxonomy/category.terms.html | 2 |
6 files changed, 23 insertions, 23 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index e977168..c62d768 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -1,4 +1,4 @@ -baseurl = "http://hugo.spf13.com/" +baseurl = "/" languageCode = "en-us" title = "Hugo Future Imperfect" theme = "hugo-future-imperfect" diff --git a/layouts/partials/favicon.html b/layouts/partials/favicon.html index 47ddd20..9aab910 100644 --- a/layouts/partials/favicon.html +++ b/layouts/partials/favicon.html @@ -1,18 +1,18 @@ {{ if .Site.Params.loadFavicon }} - {{ with .Site.Params.faviconVersion }} - {{ $.Scratch.Set "favVer" "-" }} - {{ $.Scratch.Add "favVer" . }} - {{ else }} - {{ $.Scratch.Set "favVer" "" }} - {{ end }} + {{ with .Site.Params.faviconVersion }} + {{ $.Scratch.Set "favVer" "-" }} + {{ $.Scratch.Add "favVer" . }} + {{ else }} + {{ $.Scratch.Set "favVer" "" }} + {{ end }} - {{ $favVer := $.Scratch.Get "favVer" }} + {{ $favVer := $.Scratch.Get "favVer" }} - <link rel="apple-touch-icon-precomposed" - href='/favicon/apple-touch-icon-precomposed{{ $favVer }}.png'> - <link rel="icon" href='/favicon/favicon{{ $favVer }}.png'> - <!--[if IE]><link rel="shortcut icon" href='/favicon{{ $favVer }}.ico'><![endif]--> - <meta name="msapplication-TileColor" content="#da532c"> - <meta name="msapplication-TileImage" - content='/favicon/mstile{{ $favVer }}.png'> + <link rel="apple-touch-icon-precomposed" + href='{{"/favicon/apple-touch-icon-precomposed" | relURL }}{{ $favVer }}.png'> + <link rel="icon" href='{{"/favicon/favicon" | relURL }}/favicon/favicon{{ $favVer }}.png'> + <!--[if IE]><link rel="shortcut icon" href='/favicon{{ $favVer }}.ico'><![endif]--> + <meta name="msapplication-TileColor" content="#da532c"> + <meta name="msapplication-TileImage" + content='/favicon/mstile{{ $favVer }}.png'> {{ end }} diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html index 4f78246..1f3c2bd 100644 --- a/layouts/partials/navbar.html +++ b/layouts/partials/navbar.html @@ -1,11 +1,11 @@ <!-- Header --> <header id="header"> {{ if .IsHome }} - <h1><a href="/">{{ .Site.Params.navbarTitle }}</a></h1> + <h1><a href="{{ .Site.BaseURL }}">{{ .Site.Params.navbarTitle }}</a></h1> {{ else if ne .Section "" }} - <h1><a href="/">{{ .Section }}</a></h1> + <h1><a href="{{ .Site.BaseURL }}">{{ .Section }}</a></h1> {{ else }} - <h1><a href="/">{{ .Title }}</a></h1> + <h1><a href="{{ .Site.BaseURL }}">{{ .Title }}</a></h1> {{ end }} <nav class="links"> diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index 890e904..db36002 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -6,11 +6,11 @@ {{ $pic := .Site.Params.intro.pic }} {{ with $pic.src }} {{ if $pic.circle }} - <img src="{{ . }}" class="intro-circle" width="{{ $pic.width }}" alt="{{ $pic.alt }}"> + <a href='{{"/" | relURL}}'><img src="{{ . | relURL }}" class="intro-circle" width="{{ $pic.width }}" alt="{{ $pic.alt }}" /></a> {{ else if $pic.imperfect }} - <a href="/" class="logo"><img src="{{ . }}" alt="{{ $pic.alt }}" /></a> + <a href='{{"/" | relURL}}' class="logo"><img src="{{ . | relURL }}" alt="{{ $pic.alt }}" /></a> {{ else }} - <img src="{{ . }}" width="{{ $pic.width }}" alt="{{ $pic.alt }}"> + <a href='{{"/" | relURL}}'><img src="{{ . | relURL }}" width="{{ $pic.width }}" alt="{{ $pic.alt }}" /></a> {{ end }} {{ end }} {{ with .Site.Params.intro }} diff --git a/layouts/post/featured.html b/layouts/post/featured.html index 191c3aa..fd7df7b 100644 --- a/layouts/post/featured.html +++ b/layouts/post/featured.html @@ -9,7 +9,7 @@ {{ $img := $.Scratch.Get "img" }} <a href="{{ .Permalink }}" class="image featured"> - <img src="{{ $path }}/{{ .Params.featured }}" alt="{{ $alt }}"> + <img src="{{ $path | relURL }}/{{ .Params.featured }}" alt="{{ $alt }}"> </a> {{ end }} {{ end }} diff --git a/layouts/taxonomy/category.terms.html b/layouts/taxonomy/category.terms.html index 93264ef..f6675ca 100644 --- a/layouts/taxonomy/category.terms.html +++ b/layouts/taxonomy/category.terms.html @@ -20,7 +20,7 @@ <article> <header> {{ if ne $value.Name "" }} - <a href="/{{ $data.Plural }}/{{ $value.Name | urlize }}">{{ $value.Name }}</a> + <a href="{{"/" | relURL}}{{ $data.Plural }}/{{ $value.Name | urlize }}">{{ $value.Name }}</a> <span style="float:right;">{{ $value.Count }}</span> {{ else }} Uncategorized |