From db51245dad2a8a7971a38726c60c8c69ccd2569a Mon Sep 17 00:00:00 2001 From: Junnygram Date: Sat, 4 Apr 2026 06:41:40 +0100 Subject: [PATCH] Fix: replaced deprecated .Language.LanguageDirection with .Language.Direction for issue #935 Signed-off-by: Junnygram --- hugo.toml | 1 + layouts/404.html | 2 +- layouts/_default/baseof.html | 1 + layouts/docs/baseof.html | 2 +- layouts/partials/head-css.html | 30 ++++++++++++++++++++++++++++++ layouts/release/baseof.html | 1 + layouts/video/baseof.html | 1 + layouts/video/video.html | 2 +- 8 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 layouts/partials/head-css.html diff --git a/hugo.toml b/hugo.toml index b5866d83a..cbcfa4c99 100644 --- a/hugo.toml +++ b/hugo.toml @@ -65,6 +65,7 @@ id = "G-HX135VWX9B" languageName = "English" # Weight used for sorting. weight = 1 +direction = "ltr" [languages.en.params] title = "Layer5" description = "Product Documentation" diff --git a/layouts/404.html b/layouts/404.html index e139bb0fa..410580771 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -1,5 +1,5 @@ - + {{ partial "head.html" . }} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index f9b814465..71d7b856c 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -3,6 +3,7 @@ itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" + dir="{{ .Site.Language.Direction }}" class="no-js" > diff --git a/layouts/docs/baseof.html b/layouts/docs/baseof.html index c00a1838c..3503963fb 100644 --- a/layouts/docs/baseof.html +++ b/layouts/docs/baseof.html @@ -1,5 +1,5 @@ - + {{ partial "head.html" . }} diff --git a/layouts/partials/head-css.html b/layouts/partials/head-css.html new file mode 100644 index 000000000..b2d8a0588 --- /dev/null +++ b/layouts/partials/head-css.html @@ -0,0 +1,30 @@ +{{ $scssMain := "scss/main.scss" -}} +{{ $css := resources.Get $scssMain + | toCSS (dict "enableSourceMap" (not hugo.IsProduction)) -}} + +{{/* NOTE: we only apply `postCSS` in production or for RTL languages. This +makes it snappier to develop in Chrome, but it may look sub-optimal in other +browsers. */ -}} + +{{ if eq .Site.Language.Direction "rtl" -}} + {{ $css = $css + | postCSS (dict "use" "autoprefixer rtlcss" "noMap" true) + | resources.Copy (replace $scssMain "." ".rtl.") -}} +{{ else if hugo.IsProduction -}} + {{ $css = $css | postCSS -}} +{{ end -}} + +{{ if hugo.IsProduction -}} + {{ $css = $css | minify | fingerprint -}} + +{{ end -}} + +{{ with $css -}} + +{{ else -}} + {{ errorf "Resource not found or error building CSS: %s" $scssMain -}} +{{ end -}} + +{{- /**/ -}} diff --git a/layouts/release/baseof.html b/layouts/release/baseof.html index 7468b8296..2145f978f 100644 --- a/layouts/release/baseof.html +++ b/layouts/release/baseof.html @@ -3,6 +3,7 @@ itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" + dir="{{ .Site.Language.Direction }}" class="no-js" > diff --git a/layouts/video/baseof.html b/layouts/video/baseof.html index 0d59c3f9e..395dec3e8 100644 --- a/layouts/video/baseof.html +++ b/layouts/video/baseof.html @@ -3,6 +3,7 @@ itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" + dir="{{ .Site.Language.Direction }}" class="no-js" > diff --git a/layouts/video/video.html b/layouts/video/video.html index 6747de61d..02686a8f0 100644 --- a/layouts/video/video.html +++ b/layouts/video/video.html @@ -1,5 +1,5 @@ - + {{ partial "head.html" . }}