From 20909d29d9a8f59f4a60d4a46fe0ab2efc0b43ae Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Sat, 13 Jan 2024 17:55:34 +0000
Subject: [PATCH] fix semantic html errors #120

---
 layouts/_default/baseof.html |   38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 81e0bdd..8fa13bb 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -1,9 +1,11 @@
-{{ $config := site.Params }}
-{{ $context := . }}
+{{- $config := site.Params }}
+{{- $context := . }}
+{{- $item_type := "http://schema.org/WebPage" }}
+{{- $lang := site.Language.Lang }}
+{{- $is_dark := $config.enableDarkMode }}
+{{- $default_mode := $config.defaultLightingMode -}}
 <!doctype html>
-<html lang="{{ site.Language.Lang }}"{{ with $config.enableDarkMode }} class="dark"{{ end }}{{ with $config.defaultLightingMode }}
-  data-mode="{{ . }}"
-{{ end }}>
+<html lang={{ $lang }}{{ with $is_dark }} class=dark{{ end }}{{ with $default_mode }} data-mode={{ . }}{{ end }} itemscope itemtype={{ $item_type }}>
 <head>
   {{- partial "head/index" . }}
 </head>
@@ -11,22 +13,22 @@
   <header class="nav_header">
     {{- partial "nav" . }}
   </header>
-  {{ if or (eq .Section $config.blogDir) (eq .Type "search" ) }}
+  {{- if or (eq .Section $config.blogDir) (eq .Type "search" ) }}
     {{- block "main" . }}{{ end }}
-  {{ else }}
+  {{- else }}
   <div class="main wrap pt-4">
-    {{ $docSections := $config.docSections }}
+    {{- $docSections := $config.docSections }}
     {{- with $docSections }}{{- else }}
       {{- $docSections = "docs" }}
     {{- end }}
-    {{ $uniqueHomepage := .IsHome }}
-    {{ if $config.uniqueHomepage }}
-      {{ if .IsHome }}
-        {{ $uniqueHomepage = true }}
-      {{ end }}
-    {{ else }}
-      {{ $uniqueHomepage = false }}
-    {{ end }}
+    {{- $uniqueHomepage := .IsHome }}
+    {{- if $config.uniqueHomepage }}
+      {{- if .IsHome }}
+        {{- $uniqueHomepage = true }}
+      {{- end }}
+    {{- else }}
+      {{- $uniqueHomepage = false }}
+    {{- end }}
     {{- if and (in $docSections .Section) (ne $uniqueHomepage true) }}
       {{- partial "document" . }}
     {{- else }}
@@ -35,11 +37,11 @@
       </div>
     {{- end -}}
   </div>
-  {{ end }}
+  {{- end }}
   {{- partial "scripts/translations" . -}}
   {{- partialCached "footer" . -}}
   {{- partialCached "sprites" . -}}
   {{- partial "scripts/bundle" . -}}
   {{- partial "scripts/mermaid" . -}}
 </body>
-</html>
\ No newline at end of file
+</html>

--
Gitblit v1.10.0