diff --git a/assets/scss/common/_icons.scss b/assets/scss/common/_icons.scss index 146859da7..da6f04c00 100644 --- a/assets/scss/common/_icons.scss +++ b/assets/scss/common/_icons.scss @@ -1,25 +1,25 @@ // scss-docs-start icons -$form-check-input-checked-bg-image: url("/icons/form-check-input-checked-bg-image.svg") !default; -$form-check-radio-checked-bg-image: url("/icons/form-check-radio-checked-bg-image.svg") !default; -$form-check-input-indeterminate-bg-image: url("/icons/form-check-input-indeterminate-bg-image.svg") !default; -$form-switch-bg-image: url("/icons/form-switch-bg-image.svg") !default; -$form-switch-bg-image-dark: url("/icons/form-switch-bg-image-dark.svg") !default; -$form-switch-focus-bg-image: url("/icons/form-switch-focus-bg-image.svg") !default; -$form-switch-checked-bg-image: url("/icons/form-switch-checked-bg-image.svg") !default; -$form-select-indicator: url("/icons/form-select-indicator.svg") !default; -$form-select-indicator-dark: url("/icons/form-select-indicator-dark.svg") !default; -$form-feedback-icon-valid: url("/icons/form-feedback-icon-valid.svg") !default; -$form-feedback-icon-invalid: url("/icons/form-feedback-icon-invalid.svg") !default; -$navbar-light-toggler-icon-bg: url("/icons/navbar-light-toggler-icon-bg.svg") !default; -$navbar-dark-toggler-icon-bg: url("/icons/navbar-dark-toggler-icon-bg.svg") !default; -$accordion-button-icon: url("/icons/accordion-button-icon.svg") !default; -$accordion-button-icon-dark: url("/icons/accordion-button-icon-dark.svg") !default; -$accordion-button-active-icon: url("/icons/accordion-button-active-icon.svg") !default; -$accordion-button-active-icon-dark: url("/icons/accordion-button-active-icon-dark.svg") !default; -$carousel-control-prev-icon-bg: url("/icons/carousel-control-prev-icon-bg.svg") !default; -$carousel-control-next-icon-bg: url("/icons/carousel-control-next-icon-bg.svg") !default; -$btn-close-bg: url("/icons/btn-close-bg.svg") !default; -$btn-toggle: url("/icons/btn-toggle.svg") !default; -$btn-toggle-dark: url("/icons/btn-toggle-dark.svg") !default; +$form-check-input-checked-bg-image: url("#{$base-url}icons/form-check-input-checked-bg-image.svg") !default; +$form-check-radio-checked-bg-image: url("#{$base-url}icons/form-check-radio-checked-bg-image.svg") !default; +$form-check-input-indeterminate-bg-image: url("#{$base-url}icons/form-check-input-indeterminate-bg-image.svg") !default; +$form-switch-bg-image: url("#{$base-url}icons/form-switch-bg-image.svg") !default; +$form-switch-bg-image-dark: url("#{$base-url}icons/form-switch-bg-image-dark.svg") !default; +$form-switch-focus-bg-image: url("#{$base-url}icons/form-switch-focus-bg-image.svg") !default; +$form-switch-checked-bg-image: url("#{$base-url}icons/form-switch-checked-bg-image.svg") !default; +$form-select-indicator: url("#{$base-url}icons/form-select-indicator.svg") !default; +$form-select-indicator-dark: url("#{$base-url}icons/form-select-indicator-dark.svg") !default; +$form-feedback-icon-valid: url("#{$base-url}icons/form-feedback-icon-valid.svg") !default; +$form-feedback-icon-invalid: url("#{$base-url}icons/form-feedback-icon-invalid.svg") !default; +$navbar-light-toggler-icon-bg: url("#{$base-url}icons/navbar-light-toggler-icon-bg.svg") !default; +$navbar-dark-toggler-icon-bg: url("#{$base-url}icons/navbar-dark-toggler-icon-bg.svg") !default; +$accordion-button-icon: url("#{$base-url}icons/accordion-button-icon.svg") !default; +$accordion-button-icon-dark: url("#{$base-url}icons/accordion-button-icon-dark.svg") !default; +$accordion-button-active-icon: url("#{$base-url}icons/accordion-button-active-icon.svg") !default; +$accordion-button-active-icon-dark: url("#{$base-url}icons/accordion-button-active-icon-dark.svg") !default; +$carousel-control-prev-icon-bg: url("#{$base-url}icons/carousel-control-prev-icon-bg.svg") !default; +$carousel-control-next-icon-bg: url("#{$base-url}icons/carousel-control-next-icon-bg.svg") !default; +$btn-close-bg: url("#{$base-url}icons/btn-close-bg.svg") !default; +$btn-toggle: url("#{$base-url}icons/btn-toggle.svg") !default; +$btn-toggle-dark: url("#{$base-url}icons/btn-toggle-dark.svg") !default; // scss-docs-end icons diff --git a/assets/scss/common/_variables-dart.scss b/assets/scss/common/_variables-dart.scss index 976c55166..bef19bfb7 100644 --- a/assets/scss/common/_variables-dart.scss +++ b/assets/scss/common/_variables-dart.scss @@ -5,6 +5,8 @@ $enable-important-utilities: true !default; // Remove the border from the focused navigation toggler $navbar-toggler-focus-width: 0 !default; +$base-url: h.$base-url; + $font-family-sans-serif: h.$theme-font, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default; $font-size-base: h.$font-size-base !default; $headings-font-weight: 600 !default; diff --git a/assets/scss/common/_variables.scss b/assets/scss/common/_variables.scss index 92bb338aa..093d06add 100644 --- a/assets/scss/common/_variables.scss +++ b/assets/scss/common/_variables.scss @@ -5,6 +5,8 @@ $enable-important-utilities: true !default; // Remove the border from the focused navigation toggler $navbar-toggler-focus-width: 0 !default; +$base-url: $base-url; + // scss-docs-start font $font-family-sans-serif: $theme-font, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji" !default; $font-size-base: $font-size-base !default;; diff --git a/go.mod b/go.mod index 001422010..aa6ef95fa 100644 --- a/go.mod +++ b/go.mod @@ -9,8 +9,8 @@ require ( github.com/gethinode/mod-fontawesome v1.9.0 // indirect github.com/gethinode/mod-katex v1.1.0 // indirect github.com/gethinode/mod-leaflet v1.1.0 // indirect - github.com/gethinode/mod-lottie v1.5.2 // indirect - github.com/gethinode/mod-utils/v2 v2.3.5 // indirect + github.com/gethinode/mod-lottie v1.5.3 // indirect + github.com/gethinode/mod-utils/v2 v2.3.6 // indirect github.com/nextapps-de/flexsearch v0.0.0-20240110101704-4c3966709f85 // indirect github.com/twbs/bootstrap v5.3.3+incompatible // indirect ) diff --git a/go.sum b/go.sum index 640fa7ff0..44d82c0c1 100644 --- a/go.sum +++ b/go.sum @@ -178,6 +178,8 @@ github.com/gethinode/mod-lottie v1.5.1 h1:84ZmOTKJH75wsd/YjPaaBRkTeLnmRROv9iFlQV github.com/gethinode/mod-lottie v1.5.1/go.mod h1:z0Q6EADM7pN7gmhCzDx2VR4uG5mxn9qbsphtxjIkssY= github.com/gethinode/mod-lottie v1.5.2 h1:UvrNAQeD/97Q5fbv3uKIY48fY3IWJeLy/v206Gb0F6Y= github.com/gethinode/mod-lottie v1.5.2/go.mod h1:HM1pA85EiPO7RtNysw/a2ZzRqktO2WvB/KyWLOuynzg= +github.com/gethinode/mod-lottie v1.5.3 h1:fvCjCoZoCEhY2aou30oEsEo6N4tVSI0ijFyXS3wNib0= +github.com/gethinode/mod-lottie v1.5.3/go.mod h1:XHVMuPsuJIm9/Eb2ql4jsT49/BQqMlBiirQoty4uHAo= github.com/gethinode/mod-utils v1.0.0 h1:cqHm2xS5uDiJzRm1KfHaNbq6uMVDKLhQa8/BuTZ1nhY= github.com/gethinode/mod-utils v1.0.0/go.mod h1:ONJm3pHCq7nvaPNjusLZNCeCbhOhSBH4HVKHwK1FdYE= github.com/gethinode/mod-utils v1.0.1 h1:jhZGlGFHHL1f5HXbBMXfiZ2gCz4TVafAzjnRPTIBSEE= @@ -214,6 +216,8 @@ github.com/gethinode/mod-utils/v2 v2.3.4 h1:4OmUsLW7FyQL7vJhg/Iy9E7nFXWL955qCtsj github.com/gethinode/mod-utils/v2 v2.3.4/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY= github.com/gethinode/mod-utils/v2 v2.3.5 h1:r8V330xQkHTjzAFNCde1Kpz6fgidzmMRW82eIonUnOo= github.com/gethinode/mod-utils/v2 v2.3.5/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY= +github.com/gethinode/mod-utils/v2 v2.3.6 h1:Ta+WKc83sK9ZROKmUwS4pA32Qm0bQqoMmWHEOzDvZ5Y= +github.com/gethinode/mod-utils/v2 v2.3.6/go.mod h1:GTYeknoLujNjfDxI+V9Dcug26CYJSTJ0B/U2dagw9oY= github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3 h1:H/qVR5O4BXjRjD+5PZB+r4ug2BSJ2Of4RtwOntd+OKo= github.com/nextapps-de/flexsearch v0.0.0-20230711092928-1243fd883ec3/go.mod h1:5GdMfPAXzbA2gXBqTjC6l27kioSYzHlqDMh0+wyx7sU= github.com/nextapps-de/flexsearch v0.0.0-20240108021025-afd75f742f22 h1:re7L8FxbXQpnX8BgzkdUnDpsUmloGNyLmiy2ZCln8pg= diff --git a/layouts/404.html b/layouts/404.html index 26d01cd72..6301a3236 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,4 +1,5 @@ {{ define "main" }} + {{ $base := partial "utilities/GetStaticURL" (dict "url" "/") }}
@@ -7,7 +8,7 @@

404

{{ T "pageNotFoundTitle" }}

- {{- $home := printf "%s" ("/" | relLangURL) (T "pageNotFoundHome") -}} + {{- $home := printf "%s" $base (T "pageNotFoundHome") -}}

{{ T "pageNotFound" $home | safeHTML }}

diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 0432e1e6d..dfca2634d 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -29,6 +29,10 @@ {{- /* Define main breakpoint */ -}} {{- $.Scratch.Set "breakpoint" (partial "utilities/GetBreakpoint.html") }} +{{- /* Define base URL */ -}} +{{ $lang := site.LanguageCode | default site.Language.Lang }} +{{ $.Scratch.Set "baseURL" (strings.TrimSuffix (printf "%s/" $lang) site.Home.RelPermalink) }} + diff --git a/layouts/_default/single/header.html b/layouts/_default/single/header.html index 179c9eddd..17cf6c7cb 100644 --- a/layouts/_default/single/header.html +++ b/layouts/_default/single/header.html @@ -32,7 +32,7 @@
{{ range (.GetTerms "tags") -}} - {{- $url := (path.Join .Page.RelPermalink) | relLangURL -}} + {{- $url := .Page.RelPermalink -}} {{ partial "assets/button.html" (dict "href" $url "title" .LinkTitle "color" "light" "size" "sm") }} {{ end -}}
@@ -41,7 +41,7 @@
{{ range (.GetTerms "tags") -}} - {{- $url := (path.Join .Page.RelPermalink) | relLangURL -}} + {{- $url := .Page.RelPermalink -}} {{ partial "assets/button.html" (dict "href" $url "title" .LinkTitle "color" "primary" "size" "sm" "outline" "true") }} {{ end -}}
diff --git a/layouts/alias.html b/layouts/alias.html index 797f46d50..d2acd326b 100644 --- a/layouts/alias.html +++ b/layouts/alias.html @@ -1,11 +1,12 @@ +{{ $lang := site.LanguageCode | default site.Language.Lang }} - + {{ .Permalink }} - + \ No newline at end of file diff --git a/layouts/partials/assets/breadcrumb.html b/layouts/partials/assets/breadcrumb.html index 3a2be590f..0b9e556dc 100644 --- a/layouts/partials/assets/breadcrumb.html +++ b/layouts/partials/assets/breadcrumb.html @@ -22,7 +22,7 @@ {{- range $index, $item := $page.Ancestors.Reverse -}} {{- $title := .LinkTitle -}} {{- if .IsHome }}{{ $title = T "home" }}{{ end -}} - {{- $address := or .RelPermalink (.Params.Redirect | relLangURL) -}} + {{- $address := or .RelPermalink .Params.Redirect -}} {{ if $address }} {{ else }} diff --git a/layouts/partials/assets/card.html b/layouts/partials/assets/card.html index 9c800f4a6..f0eac200e 100644 --- a/layouts/partials/assets/card.html +++ b/layouts/partials/assets/card.html @@ -119,7 +119,7 @@ {{- range $index, $tag := first $maxTags ($page.GetTerms "tags") -}} {{- if gt $index 0 }} • {{ end -}} - {{ $tag.LinkTitle }} + {{ $tag.LinkTitle }} {{- end -}}

{{- end -}} diff --git a/layouts/partials/assets/helpers/image-definition.html b/layouts/partials/assets/helpers/image-definition.html index 5f19ca40f..6e772061a 100644 --- a/layouts/partials/assets/helpers/image-definition.html +++ b/layouts/partials/assets/helpers/image-definition.html @@ -101,7 +101,7 @@ {{ if or (hasSuffix $url "svg") $plain }} - {{- $fallbackURL = $url -}} + {{- $fallbackURL = partial "utilities/GetStaticURL" (dict "url" $url) -}} {{ else }} {{- $fallbackURL = partial "assets/helpers/image-set.html" (dict "url" $url "img" $img "dims" ($dims | last 1) "transform" $transform "hook" $hook "format" "jpg" "includeWidth" false) -}} {{- $imgset = partial "assets/helpers/image-set.html" (dict "url" $url "img" $img "dims" $dims "transform" $transform "hook" $hook) -}} diff --git a/layouts/partials/assets/navbar-item.html b/layouts/partials/assets/navbar-item.html index 725e30ebe..865c9f9a3 100644 --- a/layouts/partials/assets/navbar-item.html +++ b/layouts/partials/assets/navbar-item.html @@ -19,9 +19,10 @@ {{- $class := .class -}} {{- $cue := .cue | default site.Params.main.externalLinks.cue -}} {{- $tab := .tab | default site.Params.main.externalLinks.tab -}} +{{- $baseURL := $page.Scratch.Get "baseURL" -}} -{{- $menuURL := (or $menu.PageRef $menu.URL) | relLangURL -}} -{{- $pageURL := $page.RelPermalink | relLangURL -}} +{{- $menuURL := urls.JoinPath $baseURL ((or $menu.PageRef $menu.URL) | relLangURL) -}} +{{- $pageURL := $page.RelPermalink -}} {{- $isActive := or (and (hasPrefix $pageURL $menuURL) (ne $menuURL ("/" | relLangURL))) (eq $pageURL $menuURL) -}} {{- $isAlias := $menu.Params.alias -}} {{- $isIcon := $menu.Params.icon -}} diff --git a/layouts/partials/assets/navbar.html b/layouts/partials/assets/navbar.html index 0d73750e4..d2223707e 100644 --- a/layouts/partials/assets/navbar.html +++ b/layouts/partials/assets/navbar.html @@ -53,6 +53,7 @@ {{- $size := .size -}} {{- $collapsed := .collapsed -}} {{- $page := .page -}} + {{- $baseURL := .baseURL -}} {{- $list := site.Params.docs.releases -}} {{- $id := .id -}} {{- $version := partial "utilities/GetVersion.html" (dict "page" $page) -}} @@ -70,7 +71,7 @@ {{- end -}} {{ if $item.url }}
  • - {{- $url := (path.Join $item.url) | relLangURL -}} + {{- $url := (urls.JoinPath $baseURL $item.url) | relLangURL -}} {{ $item.label }} {{ if $item.latest }} ({{ T "latest" }}){{ end }} {{ if $active }} @@ -86,7 +87,7 @@ {{- if site.Params.docs.overview -}} {{ if gt (len $list) 0 }}
  • {{ end }}
  • - {{- $url := (path.Join site.Params.docs.overview) | relLangURL -}} + {{- $url := (urls.JoinPath $baseURL site.Params.docs.overview) | relLangURL -}} {{ T "allVersions" }}
  • {{- end -}} @@ -98,6 +99,7 @@ {{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}} {{- $id := .id | default (printf "navbar-%d" 0) -}} {{- $page := .page -}} +{{- $baseURL := $page.Scratch.Get "baseURL" -}} {{- $defaultMenu := "main" -}} {{- $menuName := .menus | default $defaultMenu }} @@ -152,6 +154,10 @@ {{- end -}} {{- end -}} +{{ if $logo }}{{ $logo = urls.JoinPath $baseURL $logo }}{{ end }} +{{ if $logoLight }}{{ $logoLight = urls.JoinPath $baseURL $logoLight }}{{ end }} +{{ if $logoDark }}{{ $logoDark = urls.JoinPath $baseURL $logoDark }}{{ end }} + {{- $title := site.Title -}} {{- if .title -}} {{- $title = .title -}} @@ -255,8 +261,8 @@ {{- if $enableVersions -}} - {{- partial "partials/navbar-versions.html" (dict "page" $page "size" $size "collapsed" true "id" .id) -}} - {{- partial "partials/navbar-versions.html" (dict "page" $page "size" $size "collapsed" false "id" .id) -}} + {{- partial "partials/navbar-versions.html" (dict "page" $page "size" $size "collapsed" true "id" .id "baseURL" $baseURL) -}} + {{- partial "partials/navbar-versions.html" (dict "page" $page "size" $size "collapsed" false "id" .id "baseURL" $baseURL) -}} {{- end -}} @@ -276,7 +282,7 @@ {{- end -}} {{- else -}} {{- range site.Languages -}} -
  • {{ default .Lang .LanguageName }}
  • +
  • {{ default .Lang .LanguageName }}
  • {{- end -}} {{- end -}} diff --git a/layouts/partials/assets/sidebar.html b/layouts/partials/assets/sidebar.html index 46f18e4f5..cbb5b89b6 100644 --- a/layouts/partials/assets/sidebar.html +++ b/layouts/partials/assets/sidebar.html @@ -27,7 +27,7 @@ {{- $data := .menu -}} {{- $doc_slug := $group.title | urlize -}} - {{- $href := or $group.link (printf "%s/" (relLangURL (path.Join $baseURL $doc_slug))) -}} + {{- $href := or $group.link (partial "utilities/GetStaticURL" (dict "url" $doc_slug)) -}} {{- $collapsed := strings.HasPrefix $page.RelPermalink $href -}}
  • diff --git a/layouts/partials/head/head.html b/layouts/partials/head/head.html index 4d95c24e8..b75d58807 100644 --- a/layouts/partials/head/head.html +++ b/layouts/partials/head/head.html @@ -25,7 +25,7 @@ {{ else if .Site.Params.style.themeFontPreload }} - {{ $font := .Site.Params.style.themeFontPreload }} + {{ $font := partial "utilities/GetStaticURL" (dict "url" .Site.Params.style.themeFontPreload) }} {{- end -}} {{ partial "head/seo.html" . }} diff --git a/layouts/partials/head/icons.html b/layouts/partials/head/icons.html index b03d16823..f0c0791c8 100644 --- a/layouts/partials/head/icons.html +++ b/layouts/partials/head/icons.html @@ -35,7 +35,9 @@ {{- end }} {{- end -}} +{{ $base := partial "utilities/GetStaticURL" (dict "url" "/") }} {{- range resources.Match "icons/**.svg" -}} - {{- $icon := . | resources.ExecuteAsTemplate .RelPermalink $params -}} + {{- $target := strings.TrimPrefix $base .RelPermalink -}} + {{- $icon := . | resources.ExecuteAsTemplate $target $params -}} {{- $icon.Publish -}} {{- end -}} \ No newline at end of file diff --git a/layouts/partials/head/stylesheet.html b/layouts/partials/head/stylesheet.html index 60b278956..57f858238 100644 --- a/layouts/partials/head/stylesheet.html +++ b/layouts/partials/head/stylesheet.html @@ -40,6 +40,7 @@ {{- $overlayOffset := $navbarOffset -}} {{- if site.Params.navigation.overlay }}{{ $overlayOffset = "0rem" }}{{ end }} {{- $vars := dict + "base-url" (page.Scratch.Get "baseURL" | default "/") "theme-font" (default "Inter" site.Params.style.themeFont) "font-size-base" (default "1rem" site.Params.style.fontSizeBase) "primary" (default "#007bff" site.Params.style.primary) diff --git a/layouts/tags/list.html b/layouts/tags/list.html index 52bbdd250..3b8560052 100644 --- a/layouts/tags/list.html +++ b/layouts/tags/list.html @@ -24,7 +24,7 @@ {{ .Count }} {{ if gt .Count 1 }} {{ T "articles" }} {{ else }} {{ T "article" }} {{ end }}
  • {{ end }} @@ -48,7 +48,7 @@

    {{ $year }}

    {{ $.Scratch.Set "lastYear" $year }} {{ end }} - {{ if .Draft }}{{ T "draft" | upper }}: {{ end }}{{ .Title | .Page.RenderString }} + {{ if .Draft }}{{ T "draft" | upper }}: {{ end }}{{ .Title | .Page.RenderString }}
    {{ end }} diff --git a/package-lock.json b/package-lock.json index b9e63b6c3..ab6a86101 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@gethinode/hinode", - "version": "0.24.0-beta7", + "version": "0.24.0-beta8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@gethinode/hinode", - "version": "0.24.0-beta7", + "version": "0.24.0-beta8", "license": "MIT", "devDependencies": { "@fullhuman/postcss-purgecss": "^6.0.0", diff --git a/package.json b/package.json index 4abf1ff76..aa59e196a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gethinode/hinode", - "version": "0.24.0-beta7", + "version": "0.24.0-beta8", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "keywords": [ "hugo",