From 5ebe0b0b8d168ce7987d50aced6b23c232bede78 Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Sun, 09 Jul 2023 12:47:24 +0000
Subject: [PATCH] update template

---
 layouts/_default/baseof.html                  |   72 ++++++++++++------------
 layouts/partials/functions/getCodeConfig.html |    1 
 layouts/partials/scripts/translations.html    |    2 
 layouts/partials/nav.html                     |   18 ++---
 layouts/_default/term.html                    |   25 +++-----
 layouts/partials/opengraph.html               |    2 
 layouts/partials/mode.html                    |    4 
 7 files changed, 56 insertions(+), 68 deletions(-)

diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 05580c0..3a515d4 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -4,42 +4,42 @@
 <html lang="{{ site.Language.Lang }}"{{ with $config.enableDarkMode }} class="dark"{{ end }}{{ with $config.defaultLightingMode }}
   data-mode="{{ . }}"
 {{ end }}>
-<head>
-  {{- partial "head" . }}
-</head>
-<body class="page-{{ .Kind }}" id="pagetop">
-  <header class="nav_header">
-    {{- partial "nav" . }}
-  </header>
-  {{ if or (eq .Section site.Params.blogDir) (eq .Type "search" ) }}
-    {{- block "main" . }}{{ end }}
-  {{ else }}
-  <div class="main wrap pt-4">
-    {{ $docSections := site.Params.docSections }}
-    {{- with $docSections }}{{- else }}
-      {{- $docSections = "docs" }}
-    {{- end }}
-    {{ $uniqueHomepage := .IsHome }}
-    {{ if site.Params.uniqueHomepage }}
-      {{ if .IsHome }}
-        {{ $uniqueHomepage = true }}
-      {{ end }}
+  <head>
+    {{- partial "head" . }}
+  </head>
+  <body class="page-{{ .Kind }}" id="pagetop">
+    <header class="nav_header">
+      {{- partial "nav" . }}
+    </header>
+    {{ if or (eq .Section site.Params.blogDir) (eq .Type "search" ) }}
+      {{- block "main" . }}{{ end }}
     {{ else }}
-      {{ $uniqueHomepage = false }}
+    <div class="main wrap pt-4">
+      {{ $docSections := site.Params.docSections }}
+      {{- with $docSections }}{{- else }}
+        {{- $docSections = "docs" }}
+      {{- end }}
+      {{ $uniqueHomepage := .IsHome }}
+      {{ if site.Params.uniqueHomepage }}
+        {{ if .IsHome }}
+          {{ $uniqueHomepage = true }}
+        {{ end }}
+      {{ else }}
+        {{ $uniqueHomepage = false }}
+      {{ end }}
+      {{- if and (in $docSections .Section) (ne $uniqueHomepage true) }}
+        {{- partial "document" . }}
+      {{- else }}
+        <div class="content">
+          {{- block "main" . }}{{ end }}
+        </div>
+      {{- end -}}
+    </div>
     {{ end }}
-    {{- if and (in $docSections .Section) (ne $uniqueHomepage true) }}
-      {{- partial "document" . }}
-    {{- else }}
-      <div class="content">
-        {{- block "main" . }}{{ end }}
-      </div>
-    {{- end -}}
-  </div>
-  {{ end }}
-  {{- partial "scripts/translations" . -}}
-  {{- partialCached "footer" . -}}
-  {{- partialCached "sprites" . -}}
-  {{- partial "scripts/bundle" . -}}
-  {{- partial "scripts/other" . -}}
-</body>
+    {{- partial "scripts/translations" . -}}
+    {{- partialCached "footer" . -}}
+    {{- partialCached "sprites" . -}}
+    {{- partial "scripts/bundle" . -}}
+    {{- partial "scripts/other" . -}}
+  </body>
 </html>
diff --git a/layouts/_default/term.html b/layouts/_default/term.html
index e81b969..3034006 100644
--- a/layouts/_default/term.html
+++ b/layouts/_default/term.html
@@ -1,7 +1,7 @@
 {{ define "main" }}
 {{- $pages := .Data.Pages }}
 {{ .Data.Terms }}
-<div class = 'wrap pt-2 mt-2'>
+<div class="wrap pt-2 mt-2">
   {{- $paginator := .Paginate $pages -}}
   {{- $size := $paginator.PageSize }}
   {{- $scratch := newScratch }}
@@ -16,27 +16,20 @@
     {{- if in $image "https://" }}
       {{- $bg = $image }}
     {{- end }}
-  <article class = 'article mb-2'>
-    <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>
-        <h3 class = 'article_title'>{{ $value.Title }}</h3>
-        <div class = 'article_excerpt {{ if eq $index 0 }} visible {{ end }}'>
+  <article class="article mb-2">
+    <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>
+        <h3 class="article_title">{{ $value.Title }}</h3>
+        <div class="article_excerpt {{ if eq $index 0 }} visible {{ end }}">
         <p>{{ $value.Summary | truncate 100 }}</p>
         </div>
       </div>
     </a>
   </article>
-  {{- if and (eq $index 0) (gt $size 1)  }}<div class = 'grid-2 article_showcase'>{{ end }}
+  {{- if and (eq $index 0) (gt $size 1)  }}<div class="grid-2 article_showcase">{{ end }}
   {{- if and (eq $index (add $size -1)) (gt $size 1) }}</div>{{ end }}
   {{- end }}
 </div>
-<!-- <a href = '{{ absURL (printf "post/%s" "") }}' class = 'post_nav'>
-  <span class = 'post_next'>View Archive
-  <svg class="icon icon_scale">
-    <use xlink:href="#double-arrow"></use>
-  </svg>
-  </span>
-</a> -->
 {{ end }}
diff --git a/layouts/partials/functions/getCodeConfig.html b/layouts/partials/functions/getCodeConfig.html
index 2c30dc8..a2388b0 100644
--- a/layouts/partials/functions/getCodeConfig.html
+++ b/layouts/partials/functions/getCodeConfig.html
@@ -1,4 +1,3 @@
-<!-- will return an array holding 1) Whether to show line numbers or not 2) maximum number of lines per code block -->
 {{- $s := site.Params }}
 {{- $p := .Params }}
 {{- $maxCodeLines := default 100 $s.codeMaxLines }}
diff --git a/layouts/partials/mode.html b/layouts/partials/mode.html
index bcf4b69..cf2ffc0 100644
--- a/layouts/partials/mode.html
+++ b/layouts/partials/mode.html
@@ -1,4 +1,4 @@
-<div class="color_mode">
-  <label for="mode"></label>
+<div class=color_mode>
+  <label for=mode></label>
   <input type="checkbox" class="color_choice standardize-input" id="mode" title="Toggle Dark Mode">
 </div>
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index 5b5532d..c4efcf1 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -1,4 +1,4 @@
-{{- $s := .Site }}
+{{- $s := site }}
 {{- $sp := $s.Params }}
 <nav class="wrap nav menu">
 	<a href='{{ absLangURL "" }}' class="nav_brand">
@@ -30,19 +30,17 @@
 			<a class="nav-link{{if $active }} active{{end}}" href="{{ $url }}"><span{{if $active }} class="active"{{end}}>{{ T .Identifier | default .Name }}</span></a>
 		</li>
 		{{- end }}
-		{{ if $sp.source }}
 		{{ $repo := $sp.source }}
+		{{ with $sp.source }}
 		<li class="nav-item nav_repo">
-			<a class="nav-link" href="{{ $repo.url }}" target="_blank">
-				{{ if $repo.iconLight }}
-					{{- $litPath := absURL ($repo.iconLight) }}
-					{{- $darkPath := absURL ($repo.iconDark) }}
+			<a class="nav-link" href="{{ .url }}" target="_blank">
+				{{ if .iconLight }}
+					{{- $litPath := absURL .iconLight }}
+					{{- $darkPath := absURL .iconDark }}
 					<picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
-						<img src="{{ $litPath }}" alt="{{ $repo.name }} Repo">
+						<img src="{{ $litPath }}" alt="{{ .name }} Repo">
 					</picture>
-				{{ else }}
-					{{ $repo.name }}
-				{{ end }}
+				{{ else }}{{ .name }}{{ end }}
 			</a>
 		</li>
 		{{ end }}
diff --git a/layouts/partials/opengraph.html b/layouts/partials/opengraph.html
index 3173936..9b47eba 100644
--- a/layouts/partials/opengraph.html
+++ b/layouts/partials/opengraph.html
@@ -1,6 +1,6 @@
 {{- template "_internal/opengraph.html" . -}}
 {{- template "_internal/schema.html" . -}}
 {{- template "_internal/twitter_cards.html" . -}}
-{{- if eq (getenv "HUGO_ENV") "production" }}
+{{- if hugo.IsProduction }}
   {{- template "_internal/google_analytics.html" . }}
 {{- end }}
diff --git a/layouts/partials/scripts/translations.html b/layouts/partials/scripts/translations.html
index a482640..52afcb0 100644
--- a/layouts/partials/scripts/translations.html
+++ b/layouts/partials/scripts/translations.html
@@ -6,8 +6,6 @@
 const toggle_line_wrap_text = '{{ T "toggle_line_wrap" }}';
 const resize_snippet = '{{ T "resize_snippet" }}';
 const not_set = '{{ T "not_set" }}';
-
-// defined in i18n / translation files
 const quick_links = '{{ T "quick_links" }}';
 const search_results_label = '{{ T "search_results_label" }}';
 const short_search_query = '{{ T "short_search_query" }}'

--
Gitblit v1.10.0