From c49009b823de58ec21e4038eec91329cb538f8d2 Mon Sep 17 00:00:00 2001 From: Regis Philibert Date: Thu, 21 Apr 2022 14:23:44 -0400 Subject: [PATCH] Only add html[dir] attr if languageDirection is explicitly set --- layouts/_default/baseof.html | 2 +- layouts/partials/func/GetLanguageDirection.html | 7 +++++++ layouts/partials/language-direction.html | 3 --- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 layouts/partials/func/GetLanguageDirection.html delete mode 100644 layouts/partials/language-direction.html diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 3ef137329..dbda6879e 100755 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,5 @@ - + diff --git a/layouts/partials/func/GetLanguageDirection.html b/layouts/partials/func/GetLanguageDirection.html new file mode 100644 index 000000000..e42a42384 --- /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 31fa90c3c..000000000 --- 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 -}}