diff options
| author | Serghei Iakovlev <egrep@protonmail.ch> | 2024-09-26 18:03:18 +0200 |
|---|---|---|
| committer | Serghei Iakovlev <git@serghei.pl> | 2024-09-26 20:44:54 +0200 |
| commit | 1c6bd7d156d5627fa9808fb0e0300fb17327ebc4 (patch) | |
| tree | ea963faefbe600152e8e4b9ed08a40071c5ba597 | |
| parent | 51f2ee43c90e44a871f0c2050b9e4d6f06151010 (diff) | |
| download | gohugo-theme-ed-1c6bd7d156d5627fa9808fb0e0300fb17327ebc4.tar.gz | |
Refine site language, direction and code
| -rw-r--r-- | exampleSite/config/_default/config.yaml | 5 | ||||
| -rw-r--r-- | exampleSite/config/_default/languages.yaml | 3 | ||||
| -rw-r--r-- | layouts/_default/baseof.html | 9 | ||||
| -rw-r--r-- | layouts/_default/home.manifest.webmanifest | 6 |
4 files changed, 12 insertions, 11 deletions
diff --git a/exampleSite/config/_default/config.yaml b/exampleSite/config/_default/config.yaml index 7dc1335..719eebb 100644 --- a/exampleSite/config/_default/config.yaml +++ b/exampleSite/config/_default/config.yaml @@ -1,9 +1,6 @@ # You may need to change this line for your real project. baseURL: / -languageCode: en-us -defaultContentLanguage: en - # Keep title short to prevent overflow. # There’s no official guidance on this, but 40 characters for # mobile and 60 for desktop is roughly the sweet spot. @@ -15,7 +12,7 @@ title: Ed. enableRobotsTXT: true # When using ref or relref to resolve page links and a link cannot -# resolved, it will be logged with this log level. +# resolve, it will be logged with this log level. refLinksErrorLevel: WARNING # Kick out RSS, we'll use Atom and FEED bellow. diff --git a/exampleSite/config/_default/languages.yaml b/exampleSite/config/_default/languages.yaml index 9f1a04b..ae49ea4 100644 --- a/exampleSite/config/_default/languages.yaml +++ b/exampleSite/config/_default/languages.yaml @@ -1,4 +1,5 @@ en: - weight: 1 + languageCode: en languageDirection: ltr languageName: English + weight: 1 diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 5f095c2..30d98e2 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -1,5 +1,10 @@ -<!DOCTYPE html> -<html lang="{{ site.LanguageCode | default site.Language.Lang }}" {{- with partialCached "func/GetLanguageDirection" "GetLanguageDirection" }} dir="{{ . }}" {{- end }} prefix="og: http://ogp.me/ns#" id="top-of-site"> +<!doctype html> +<html lang="{{ site.Language.LanguageCode }}" + dir="{{ or site.Language.LanguageDirection `ltr` }}" + prefix="og: http://ogp.me/ns#" + itemscope + itemtype="https://schema.org/WebPage" + id="top-of-site"> {{ partial "head.html" . }} <body class="theme-base-{{ site.Params.colorScheme }}"> <div id="top-of-site-anchor"></div> diff --git a/layouts/_default/home.manifest.webmanifest b/layouts/_default/home.manifest.webmanifest index 53c2dec..e43108e 100644 --- a/layouts/_default/home.manifest.webmanifest +++ b/layouts/_default/home.manifest.webmanifest @@ -6,8 +6,8 @@ "name": {{ site.Title | htmlUnescape | jsonify }}, {{ with site.Params.tagline }}"short_name": {{ . | htmlUnescape | jsonify }},{{ end }} {{ with site.Params.description }}"description": {{ . | htmlUnescape | jsonify }},{{ end }} - "lang": "{{ site.LanguageCode | default site.Language.Lang }}",{{ with partialCached "func/GetLanguageDirection" "GetLanguageDirection" }} - "dir": {{ . | jsonify }},{{ end }} + "lang": "{{ site.Language.LanguageCode }}", + "dir": "{{ or site.Language.LanguageDirection `ltr` }}", "start_url": {{ (printf "/%s" $url) | jsonify }}, "display": "fullscreen", "theme_color": "#ffffff", @@ -30,5 +30,3 @@ }{{ if ne . 512 }},{{ end }}{{- end }} ] } - - |
