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 ++++++++++---------
 layouts/partials/nav.html        |    4 +-
 layouts/_default/term.html       |    2 
 layouts/partials/head/index.html |   26 ++++++------
 layouts/blog/list.html           |    2 
 5 files changed, 37 insertions(+), 35 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>
diff --git a/layouts/_default/term.html b/layouts/_default/term.html
index 3034006..de6ff3e 100644
--- a/layouts/_default/term.html
+++ b/layouts/_default/term.html
@@ -20,7 +20,7 @@
     <a href="{{ $value.Permalink }}" {{ if eq $index 0 }} class=grid-reverse {{ end }}>
       <div class="article_thumb" style="background-image: url({{ $bg }})"></div>
       <div class="article_meta {{ if eq $index 0 }} center_y {{ end }}">
-        <time class="post_date">{{ dateFormat "January 02, 2006" $value.Date }}</time>
+        <div class="post_date">{{ dateFormat "January 02, 2006" $value.Date }}</div>
         <h3 class="article_title">{{ $value.Title }}</h3>
         <div class="article_excerpt {{ if eq $index 0 }} visible {{ end }}">
         <p>{{ $value.Summary | truncate 100 }}</p>
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
index 37bff71..1e59c3f 100644
--- a/layouts/blog/list.html
+++ b/layouts/blog/list.html
@@ -22,7 +22,7 @@
     <a href="{{ $value.Permalink }}" {{ if eq $index 0 }} class="grid-reverse" {{ end }}>
       <div class="article_thumb" style="background-image: url({{ $bg }});"></div>
       <div class="article_meta {{ if eq $index 0 }} center_y {{ end }}">
-        <time class="post_date">{{ dateFormat "January 02, 2006" $value.Date }}</time>
+        <div class="post_date">{{ dateFormat "January 02, 2006" $value.Date }}</div>
         <h3 class="article_title">{{ $value.Title }}</h3>
         <div class="article_excerpt {{ if eq $index 0 }} visible {{ end }}">
         <p>{{ truncate 100 $value.Summary }}</p>
diff --git a/layouts/partials/head/index.html b/layouts/partials/head/index.html
index a9f1146..97b2f4d 100644
--- a/layouts/partials/head/index.html
+++ b/layouts/partials/head/index.html
@@ -16,29 +16,29 @@
 {{- end }}
 <title>{{ if and $t (ne (trim (lower $s) "") (trim (lower $t) "")) }}{{ $t }} | {{ end }}{{ $s }}</title>
 
-{{- partial "opengraph" . }}
+{{- partial "opengraph" . -}}
 
 {{- $options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") -}}
 {{- $styles := resources.Get "sass/main.sass" | resources.ExecuteAsTemplate "main.sass" . | resources.ToCSS $options | resources.Fingerprint "sha512" }}
 <link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
 
-{{- $sp := site.Params }}
-{{- with $sp.customCSS }}
+{{- $config := site.Params }}
+{{- with $config.customCSS }}
   {{- range . -}}
   <link rel="stylesheet" href="{{ . }}">
   {{- end }}
 {{- end }}
 
-{{ with $sp.metaThemeColor }}
-  <meta name="theme-color" content="{{.}}">
-{{ end }}
+{{- with $config.metaThemeColor }}
+  <meta name="theme-color" content="{{ . }}">
+{{- end }}
 
-{{ if .Description }}
+{{- if .Description }}
   <meta name="description" content="{{ .Description }}">
-{{ else if .IsPage }}
-  <meta name="description" content="{{ .Summary | plainify }}">
-{{ else if $sp.Description }}
-  <meta name="descripion" content="{{ $sp.Description }}">
-{{ end }}
+{{- else if .IsPage }}
+  <meta name="description" content="{{ plainify .Summary }}">
+{{- else if $config.Description }}
+  <meta name="descripion" content="{{ $config.Description }}">
+{{- end }}
 {{- partial "head/liteyoutube" . }}
-{{- partialCached "hooks/head" . }}
+{{- partialCached "hooks/head" . -}}
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index afd669e..698c6c4 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -7,9 +7,9 @@
 		<picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
 			<img src="{{ $litPath }}" alt="{{ site.Title }} Logo">
 		</picture>
-		<label class="nav_toggle toggle" title='{{ T "site_menu" }}' role="button">
+		<div class="nav_toggle toggle" title='{{ T "site_menu" }}'>
 			{{ partial "sprite" (dict "icon" "harmburger") }}
-		</label>
+		</div>
 	</a>
 	<ul class="nav_body">
 		<li class="nav-item">

--
Gitblit v1.10.0