From 680690250166c47cb0754422f1a71430cc4d0572 Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Thu, 25 Jul 2024 16:08:42 +0800 Subject: [PATCH 1/5] add feat: load "icon.svg" in the posts foler --- layouts/partials/post-summary.html | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/layouts/partials/post-summary.html b/layouts/partials/post-summary.html index 18f991e..732f7b1 100644 --- a/layouts/partials/post-summary.html +++ b/layouts/partials/post-summary.html @@ -1,7 +1,24 @@
-

{{ trim .Title " " | markdownify }}

+ {{ $random := (md5 .Title) }} + {{ $iconPath := printf "%s/icon.svg" .File.Dir }} + {{ if fileExists $iconPath }} + + {{ end }} +

+ {{ trim .Title " " | markdownify }} +

{{ partial "post-language-switcher.html" . }}
@@ -11,6 +28,7 @@ {{ .Summary | safeHTML }} {{ end }} + {{ if and (.Truncated) (.Site.Params.readMore) }}
{{ i18n "readMore" }} From 9b689084a31e1043ddcff3e78c16c1910a1609e2 Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Thu, 15 Aug 2024 13:43:06 +0800 Subject: [PATCH 2/5] upgrade DisqusShortname --- layouts/partials/comments.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html index aae2a24..3e3a652 100644 --- a/layouts/partials/comments.html +++ b/layouts/partials/comments.html @@ -1,4 +1,4 @@ -{{ if .Site.DisqusShortname }} +{{ if .Site.Config.Services.Disqus.Shortname }} {{ partial "disqus.html" . }} {{ end }} From f53cc0573b961a87831abebfe333a88808cf78ff Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Thu, 15 Aug 2024 15:54:53 +0800 Subject: [PATCH 3/5] upgrade config --- layouts/_default/rss.xml | 26 ++++++++++++++++++++++---- layouts/partials/footer.html | 2 +- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index 15a4ed7..7dccba1 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -12,9 +12,27 @@ {{ .RelPermalink }} {{ .Site.Title }}{{ if ne .Title .Site.Title }}{{ with .Title }} ({{.}}){{ end }}{{ end }} Hugo -- gohugo.io{{ with .Site.LanguageCode }} - {{.}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} + {{.}}{{end}} + {{ with .Site.Params.author }} + {{ with .email }} + {{.}} + {{ with $.Site.Params.author.name }} + ({{.}}) + {{end}} + + {{end}} + + {{ with .Site.Params.author.email }} + + {{.}} + {{ with $.Site.Params.author.name }} + ({{.}}) + {{end}} + + {{end}} + {{ end }} + + {{ with .Site.Copyright }} {{.}}{{end}}{{ if not .Date.IsZero }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} {{ with .OutputFormats.Get "RSS" }} @@ -25,7 +43,7 @@ {{ .Title }} {{ .RelPermalink }} {{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ with .Site.Params.author.email }}{{.}}{{ with $.Site.Params.author.name }} ({{.}}){{end}}{{end}} {{ .RelPermalink }} {{ .Content | html }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index ea511b7..5a01e1f 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -15,7 +15,7 @@ {{ end }}
- © {{ if isset .Site.Author "name"}}{{ .Site.Author.name }}, {{end}}{{ now.Year }} + © {{ if isset .Site.Params.author "name"}}{{ .Site.Params.author.name }}, {{end}}{{ now.Year }} {{ if .Site.Params.UmamiAnalytics.shareUrl }} {{ end }} From 422f416612f6c65a232ca947eff21179ae2a508a Mon Sep 17 00:00:00 2001 From: Junyi Hou Date: Wed, 11 Sep 2024 11:57:49 +0800 Subject: [PATCH 4/5] align with latest Hugo. Hugo is a piece of shit! --- exampleSiteMultilingual/hugo.toml | 8 +++++--- layouts/_default/single.html | 6 +++--- layouts/partials/footer.html | 18 +++++++++--------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/exampleSiteMultilingual/hugo.toml b/exampleSiteMultilingual/hugo.toml index f4be162..8a0757e 100644 --- a/exampleSiteMultilingual/hugo.toml +++ b/exampleSiteMultilingual/hugo.toml @@ -3,11 +3,13 @@ languageCode = "en-us" defaultContentLanguage = "en" title = "Anubis2 Demo Site" theme = "anubis2" -paginate = 5 - disqusShortname = "" -[author] +[pagination] +pagerSize = 5 + + +[params.author] name = "Junyi" email = "me@junyi.dev" location = "Singapore" diff --git a/layouts/_default/single.html b/layouts/_default/single.html index c9a53af..296faa9 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -23,8 +23,8 @@
{{ $readNextPosts := 3}} - {{ if isset .Site.Params "readnextposts" }} - {{ $readNextPosts = .Site.Params.readNextPosts }} + {{ if site.Params.readNextPosts }} + {{ $readNextPosts = site.Params.readNextPosts }} {{ end }} {{ if gt $readNextPosts 0 }} @@ -56,7 +56,7 @@ {{ partial "resource.html" (dict "context" . "type" "js" "filename" "js/load-mermaid.js") }} {{ $colorTheme := "light" }} - {{ if and (isset site.Params "colortheme") (ne site.Params.colortheme "") }} + {{ if and (site.Params.colortheme) (ne site.Params.colortheme "") }} {{ $colorTheme = site.Params.colortheme | lower }} {{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 5a01e1f..1a0917d 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -5,23 +5,23 @@ {{ end }}