Fix link to multilingual page resources

This commit is contained in:
Mark Dumay
2024-10-23 07:07:40 +02:00
parent a0cbdd0cbb
commit 3f5c10319b
4 changed files with 10 additions and 6 deletions

View File

@@ -13,7 +13,7 @@
{{ end }}
<!-- Initialize arguments -->
{{ $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) }}

View File

@@ -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) }}

4
package-lock.json generated
View File

@@ -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",

View File

@@ -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",