diff --git a/layouts/partials/assets/link.html b/layouts/partials/assets/link.html index 7a37ac94..593afbab 100644 --- a/layouts/partials/assets/link.html +++ b/layouts/partials/assets/link.html @@ -13,7 +13,7 @@ {{ end }} -{{ $destination := strings.TrimPrefix (strings.TrimSuffix "/" site.BaseURL) .destination }} +{{ $destination := path.Clean (strings.TrimPrefix (strings.TrimSuffix "/" site.BaseURL) .destination) }} {{ if not $destination }}{{ $destination = "/" }}{{ end }} {{- $target := "" -}} @@ -60,7 +60,9 @@ {{ $ref := partial "utilities/GetPage.html" (dict "url" $destination "page" $page) }} {{- if not $ref -}} {{ $pageContext := "" }} - {{ with $page.File }}{{ $pageContext = path.Join "/content" .Dir }}{{ end }} + {{ with $page.File }} + {{ $pageContext = path.Dir (strings.TrimPrefix hugo.WorkingDir .Filename) }} + {{ end }} {{ $isPageRes := fileExists (path.Join $pageContext $destination) }} {{ $isStatic := fileExists (path.Join "static" $destination) }} {{ if and (not $isPageRes) (not $isStatic) }} diff --git a/layouts/shortcodes/link.html b/layouts/shortcodes/link.html index 74a93a07..aa885d6d 100644 --- a/layouts/shortcodes/link.html +++ b/layouts/shortcodes/link.html @@ -81,7 +81,9 @@ {{ $ref := partial "utilities/GetPage.html" (dict "url" $url "page" .Page) }} {{- if not $ref -}} {{ $pageContext := "" }} - {{ with .Page.File }}{{ $pageContext = path.Join "/content" .Dir }}{{ end }} + {{ with .Page.File }} + {{ $pageContext = path.Dir (strings.TrimPrefix hugo.WorkingDir .Filename) }} + {{ end }} {{ $isPageRes := fileExists (path.Join $pageContext $url) }} {{ $isStatic := fileExists (path.Join "/static" $url) }} {{ if and (not $isPageRes) (not $isStatic) }} diff --git a/package-lock.json b/package-lock.json index f0ecdf39..7bdccef8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gethinode/hinode", - "version": "0.27.0", + "version": "0.27.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gethinode/hinode", - "version": "0.27.0", + "version": "0.27.1", "license": "MIT", "dependencies": { "@fullhuman/postcss-purgecss": "^6.0.0", diff --git a/package.json b/package.json index 33c34a7d..35f035a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gethinode/hinode", - "version": "0.27.0", + "version": "0.27.1", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "keywords": [ "hugo",