Skip to content

Commit 46996b3

Browse files
authored
Merge pull request #939 from Junnygram/fix-hugo-deprecation-935
Fix: resolve .Language.LanguageDirection deprecation warnings
2 parents 09b94a1 + db51245 commit 46996b3

File tree

8 files changed

+37
-3
lines changed

8 files changed

+37
-3
lines changed

hugo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ id = "G-HX135VWX9B"
6767
languageName = "English"
6868
# Weight used for sorting.
6969
weight = 1
70+
direction = "ltr"
7071
[languages.en.params]
7172
title = "Layer5"
7273
description = "Product Documentation"

layouts/404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" class="no-js">
2+
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" dir="{{ .Site.Language.Direction }}" class="no-js">
33
<head>
44
{{ partial "head.html" . }}
55
</head>

layouts/_default/baseof.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
itemscope
44
itemtype="http://schema.org/WebPage"
55
lang="{{ .Site.Language.Lang }}"
6+
dir="{{ .Site.Language.Direction }}"
67
class="no-js"
78
>
89
<head>

layouts/docs/baseof.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" class="no-js">
2+
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" dir="{{ .Site.Language.Direction }}" class="no-js">
33

44
<head>
55
{{ partial "head.html" . }}

layouts/partials/head-css.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{ $scssMain := "scss/main.scss" -}}
2+
{{ $css := resources.Get $scssMain
3+
| toCSS (dict "enableSourceMap" (not hugo.IsProduction)) -}}
4+
5+
{{/* NOTE: we only apply `postCSS` in production or for RTL languages. This
6+
makes it snappier to develop in Chrome, but it may look sub-optimal in other
7+
browsers. */ -}}
8+
9+
{{ if eq .Site.Language.Direction "rtl" -}}
10+
{{ $css = $css
11+
| postCSS (dict "use" "autoprefixer rtlcss" "noMap" true)
12+
| resources.Copy (replace $scssMain "." ".rtl.") -}}
13+
{{ else if hugo.IsProduction -}}
14+
{{ $css = $css | postCSS -}}
15+
{{ end -}}
16+
17+
{{ if hugo.IsProduction -}}
18+
{{ $css = $css | minify | fingerprint -}}
19+
<link rel="preload" href="{{ $css.RelPermalink }}" as="style" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous">
20+
{{ end -}}
21+
22+
{{ with $css -}}
23+
<link href="{{ .RelPermalink }}" rel="stylesheet"
24+
{{- with .Data.Integrity }} integrity="{{ . }}" crossorigin="anonymous"{{ end -}}
25+
>
26+
{{ else -}}
27+
{{ errorf "Resource not found or error building CSS: %s" $scssMain -}}
28+
{{ end -}}
29+
30+
{{- /**/ -}}

layouts/release/baseof.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
itemscope
44
itemtype="http://schema.org/WebPage"
55
lang="{{ .Site.Language.Lang }}"
6+
dir="{{ .Site.Language.Direction }}"
67
class="no-js"
78
>
89
<head>

layouts/video/baseof.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
itemscope
44
itemtype="http://schema.org/WebPage"
55
lang="{{ .Site.Language.Lang }}"
6+
dir="{{ .Site.Language.Direction }}"
67
class="no-js"
78
>
89
<head>

layouts/video/video.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" class="no-js">
2+
<html itemscope itemtype="http://schema.org/WebPage" lang="{{ .Site.Language.Lang }}" dir="{{ .Site.Language.Direction }}" class="no-js">
33

44
<head>
55
{{ partial "head.html" . }}

0 commit comments

Comments
 (0)