Only add html[dir] attr if languageDirection is explicitly set

This commit is contained in:
Regis Philibert 2022-04-21 14:23:44 -04:00
parent 19242fd2f8
commit c49009b823
3 changed files with 8 additions and 4 deletions

View File

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

View File

@ -0,0 +1,7 @@
{{ $dir := "" }}
{{ if ge hugo.Version "0.67.1" }}
{{ with site.Language.LanguageDirection }}
{{ $dir = . }}
{{ end }}
{{ end }}
{{ return $dir }}

View File

@ -1,3 +0,0 @@
{{- if ge hugo.Version "0.67.1" -}}
dir="{{ $.Site.Language.LanguageDirection | default "ltr" }}"
{{- end -}}