Skip to content

Commit

Permalink
Only add html[dir] attr if languageDirection is explicitly set
Browse files Browse the repository at this point in the history
  • Loading branch information
regisphilibert committed Apr 21, 2022
1 parent 19242fd commit c49009b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -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">
Expand Down
7 changes: 7 additions & 0 deletions layouts/partials/func/GetLanguageDirection.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{{ $dir := "" }}
{{ if ge hugo.Version "0.67.1" }}
{{ with site.Language.LanguageDirection }}
{{ $dir = . }}
{{ end }}
{{ end }}
{{ return $dir }}
3 changes: 0 additions & 3 deletions layouts/partials/language-direction.html

This file was deleted.

0 comments on commit c49009b

Please sign in to comment.