From 43a58bce3d5a22ca03b7228cf82e3497ec70aa69 Mon Sep 17 00:00:00 2001
From: weru <fromweru@gmail.com>
Date: Sun, 30 Jul 2023 20:45:57 +0000
Subject: [PATCH] update template
---
layouts/partials/nav.html | 13 +++---
layouts/partials/share.html | 2
layouts/blog/list.html | 31 ++++++++-------
layouts/blog/single.html | 18 +++++---
4 files changed, 35 insertions(+), 29 deletions(-)
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
index ae37779..7e7b955 100644
--- a/layouts/blog/list.html
+++ b/layouts/blog/list.html
@@ -1,6 +1,6 @@
{{ define "main" }}
{{- $pages := where site.RegularPages "Section" site.Params.blogDir }}
-<div class = 'wrap pt-2 mt-2'>
+<div class="wrap pt-2 mt-2">
{{- $paginator := .Paginate $pages -}}
{{- $size := $paginator.PageSize }}
{{- $scratch := newScratch }}
@@ -11,30 +11,33 @@
{{ $scratch.Set "image" "thumbnail.svg" }}
{{ end }}
{{ $image := $scratch.Get "image" }}
- {{ $bg := (absURL (printf "images/%s" $image)) }}
+ {{ $bg := $image }}
+ {{- if ne (in $image "images") true }}
+ {{ $bg = (absURL (printf "images/%s" $image)) }}
+ {{- end }}
{{- 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 }}'>
- <p>{{ $value.Summary | truncate 100 }}</p>
+ <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>{{ truncate 100 $value.Summary }}</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
+<!-- <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>
+ <use href="#double-arrow"></use>
</svg>
</span>
</a> -->
diff --git a/layouts/blog/single.html b/layouts/blog/single.html
index e4cf32e..f9826f0 100644
--- a/layouts/blog/single.html
+++ b/layouts/blog/single.html
@@ -6,17 +6,21 @@
<h1 class="post_title">{{ .Title }}</h1>
<div class="post_body">
<div class="post_inner">
- {{ with .Params.image }}
- {{- $image := absURL (printf "images/%s" .) }}
- {{ if in . "https://" }}
+ {{- with .Params.image }}
+ {{- $image := . }}
+ {{- if ne (in . "images") true }}
+ {{- $image = printf "images/%s" . }}
+ {{- end }}
+ {{- $image = absURL $image }}
+ {{- if in . "https://" }}
{{- $image = . }}
- {{ end }}
+ {{- end }}
<img src="{{ $image }}" alt="{{ . }}" class="post_thumbnail">
- {{ end }}
- {{ .Content }}
+ {{- end }}
+ {{- .Content }}
</div>
<div class="post_extra mb-2">
- {{ partialCached "share" . }}
+ {{- partialCached "share" . }}
</div>
<div>
{{ template "_internal/disqus.html" . }}
diff --git a/layouts/partials/nav.html b/layouts/partials/nav.html
index c4efcf1..afd669e 100644
--- a/layouts/partials/nav.html
+++ b/layouts/partials/nav.html
@@ -1,12 +1,11 @@
-{{- $s := site }}
-{{- $sp := $s.Params }}
+{{- $config := site.Params }}
<nav class="wrap nav menu">
<a href='{{ absLangURL "" }}' class="nav_brand">
- {{- $logos := $sp.logo }}
+ {{- $logos := $config.logo }}
{{- $litPath := absURL ($logos.lightMode) }}
{{- $darkPath := absURL ($logos.darkMode) }}
<picture data-lit="{{ $litPath }}" data-dark="{{ $darkPath }}">
- <img src="{{ $litPath }}" alt="{{ $s.Title }} Logo">
+ <img src="{{ $litPath }}" alt="{{ site.Title }} Logo">
</picture>
<label class="nav_toggle toggle" title='{{ T "site_menu" }}' role="button">
{{ partial "sprite" (dict "icon" "harmburger") }}
@@ -17,7 +16,7 @@
{{- partial "search" . }}
</li>
{{- $p := . }}
- {{- range $s.Menus.main }}
+ {{- range site.Menus.main }}
<li class="nav-item">
{{- $active := or ($p.IsMenuCurrent "main" .) ($p.HasMenuCurrent "main" .) }}
{{- with .Page }}
@@ -30,8 +29,8 @@
<a class="nav-link{{if $active }} active{{end}}" href="{{ $url }}"><span{{if $active }} class="active"{{end}}>{{ T .Identifier | default .Name }}</span></a>
</li>
{{- end }}
- {{ $repo := $sp.source }}
- {{ with $sp.source }}
+ {{ $repo := $config.source }}
+ {{ with $config.source }}
<li class="nav-item nav_repo">
<a class="nav-link" href="{{ .url }}" target="_blank">
{{ if .iconLight }}
diff --git a/layouts/partials/share.html b/layouts/partials/share.html
index dbdf60f..2bc4133 100644
--- a/layouts/partials/share.html
+++ b/layouts/partials/share.html
@@ -2,6 +2,6 @@
{{- $lc := T "link_copied" }}
<div class="copy" data-before="{{ $s }}" data-after="{{ $lc }}">
<svg class="icon">
- <use xlink:href="#copy"></use>
+ <use href="#copy"></use>
</svg>
</div>
\ No newline at end of file
--
Gitblit v1.10.0