diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index 952cf389..76c07dae 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -104,6 +104,9 @@ home = ["HTML", "RSS", "REDIR"] [[module.mounts]] source = "content" target = "content" + [[module.mounts]] + source = "data" + target = "data" [[module.mounts]] source = "i18n" target = "i18n" diff --git a/layouts/partials/utilities/GetResource.html b/layouts/partials/utilities/GetResource.html index 803477cb..7ec11a5f 100644 --- a/layouts/partials/utilities/GetResource.html +++ b/layouts/partials/utilities/GetResource.html @@ -1,13 +1,28 @@ {{ $url := .url -}} {{ $page := .page -}} +{{ if hasPrefix $url "/" }} + {{ $pageContext := (path.Join "/content" $page.File.Dir) -}} + {{ if hasPrefix $url $pageContext }} + {{ $url = strings.TrimPrefix $pageContext $url -}} + {{ else if hasPrefix $url "/assets/" }} + {{ $url = strings.TrimPrefix "/assets/" $url -}} + {{ end }} + {{ $url = strings.TrimPrefix "/" $url -}} +{{ end }} {{ $res := "" }} {{ $remote := hasPrefix (lower $url) "http" }} diff --git a/package-lock.json b/package-lock.json index 1cab921d..8dc2a3db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gethinode/hinode", - "version": "0.21.10", + "version": "0.21.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gethinode/hinode", - "version": "0.21.10", + "version": "0.21.11", "license": "MIT", "devDependencies": { "@fullhuman/postcss-purgecss": "^5.0.0", diff --git a/package.json b/package.json index 40f3c632..18482e24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gethinode/hinode", - "version": "0.21.10", + "version": "0.21.11", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "keywords": [ "hugo",