diff options
author | Regis Philibert <login@regisphilibert.com> | 2022-04-21 21:23:44 +0300 |
---|---|---|
committer | Regis Philibert <login@regisphilibert.com> | 2022-04-21 21:23:44 +0300 |
commit | c49009b823de58ec21e4038eec91329cb538f8d2 (patch) | |
tree | 09c324c25b735bfe12289e4c4308c8b00dad1b20 | |
parent | 19242fd2f89b9ac4d469ebbe265808fae17a2388 (diff) |
Only add html[dir] attr if languageDirection is explicitly setv2.9.0
-rwxr-xr-x | layouts/_default/baseof.html | 2 | ||||
-rw-r--r-- | layouts/partials/func/GetLanguageDirection.html | 7 | ||||
-rw-r--r-- | layouts/partials/language-direction.html | 3 |
3 files changed, 8 insertions, 4 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 3ef1373..dbda687 100755 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,5 @@ <!DOCTYPE html> -<html lang="{{ $.Site.LanguageCode | default "en" }}" {{ partial "language-direction.html" . | safeHTMLAttr }}> +<html lang="{{ site.LanguageCode | default "en" }}" {{- with partialCached "func/GetLanguageDirection" "GetLanguageDirection" }} dir="{{ . }}" {{- end }}> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> diff --git a/layouts/partials/func/GetLanguageDirection.html b/layouts/partials/func/GetLanguageDirection.html new file mode 100644 index 0000000..e42a423 --- /dev/null +++ b/layouts/partials/func/GetLanguageDirection.html @@ -0,0 +1,7 @@ +{{ $dir := "" }} +{{ if ge hugo.Version "0.67.1" }} + {{ with site.Language.LanguageDirection }} + {{ $dir = . }} + {{ end }} +{{ end }} +{{ return $dir }} diff --git a/layouts/partials/language-direction.html b/layouts/partials/language-direction.html deleted file mode 100644 index 31fa90c..0000000 --- a/layouts/partials/language-direction.html +++ /dev/null @@ -1,3 +0,0 @@ -{{- if ge hugo.Version "0.67.1" -}} - dir="{{ $.Site.Language.LanguageDirection | default "ltr" }}" -{{- end -}} |