diff --git a/hugo.toml b/hugo.toml index 9a176dd..b217ff5 100644 --- a/hugo.toml +++ b/hugo.toml @@ -22,7 +22,7 @@ defaultContentLanguageInSubdir = true languageCode = "en-us" # title = "Hermit - V2" -#enableGitInfo = true +# enableGitInfo = true pygmentsCodefences = true pygmentsUseClasses = true @@ -63,7 +63,7 @@ enableEmoji = true #homeSubtitle = "Continuing Hermit's legacy to be minimal and fast theme" footerCopyright = ' CC BY-NC 4.0' # bgImg = "" - # gitUrl = "https://github.com/username/repository/commit/" + # gitUrl = "https://github.com/1bl4z3r/hermit-V2/tree/staging" justifyContent = true diff --git a/layouts/partials/readTime.html b/layouts/partials/readTime.html index 46420c1..1881f15 100644 --- a/layouts/partials/readTime.html +++ b/layouts/partials/readTime.html @@ -1,10 +1,10 @@ -{{ if .Site.Params.readTime }} +{{- if .Site.Params.readTime }} {{ .Site.Params.readTimeSeparator }} {{ $rT := mul (div (.WordCount) 220.0) 60 }} {{ $rTH := math.Floor (div $rT 3600) }} {{ $rTM := math.Floor (div (mod $rT 3600) 60) }} {{ $rTS := mod (mod $rT 3600) 60 }} - {{ if gt $rTH 0 }}{{ $rTH }}{{ cond (gt $rTH 1) " Hours" " Hour" }}{{- end -}} - {{ if gt $rTM 0 }}{{ cond (gt $rTH 0) ", " "" }}{{ $rTM }}{{ cond (gt $rTM 1) " Minutes" " Minute" }}{{- end -}} - {{ if gt $rTS 0 }}{{ cond (gt $rTM 0) ", " "" }}{{ $rTS }}{{ cond (gt $rTS 1) " Seconds" " Second" }}{{- end -}} -{{ end }} \ No newline at end of file + {{- if gt $rTH 0 }}{{ $rTH }}{{- cond (gt $rTH 1) " Hours" " Hour" -}}{{- end -}} + {{- if gt $rTM 0 }}{{- cond (gt $rTH 0) ", " "" -}}{{ $rTM }}{{- cond (gt $rTM 1) " Minutes" " Minute" -}}{{- end -}} + {{- if gt $rTS 0 }}{{- cond (gt $rTM 0) ", " "" -}}{{ $rTS }}{{- cond (gt $rTS 1) " Seconds" " Second" -}}{{- end -}} +{{- end }} \ No newline at end of file diff --git a/layouts/partials/svg.html b/layouts/partials/svg.html index 8db608c..8b5acaa 100644 --- a/layouts/partials/svg.html +++ b/layouts/partials/svg.html @@ -70,6 +70,12 @@ {{- else if (eq .name "admonition_bug") -}} +{{- else if (eq .name "posts_single_wordcount") -}} + +{{- else if (eq .name "posts_single_date") -}} + +{{- else if (eq .name "posts_single_git_commit") -}} + {{- else -}} {{- end -}} diff --git a/layouts/posts/single.html b/layouts/posts/single.html index 714546a..d7143aa 100644 --- a/layouts/posts/single.html +++ b/layouts/posts/single.html @@ -45,17 +45,18 @@ {{- end }}

{{- end }} -

{{ i18n "wordCount" . }} {{ partial "readTime.html" . }}

-

{{ dateFormat .Site.Params.dateformNumTime .Date.Local }} - {{ if .Lastmod }} - {{ if not (eq .Lastmod .Date ) }} - [Modified : {{ dateFormat .Site.Params.dateformNumTime .Lastmod.Local }}] - {{ end }} - {{ end }} +

{{- partial "svg.html" (dict "context" . "name" "posts_single_wordcount") }}{{ i18n "wordCount" . -}} {{- partial "readTime.html" . -}}

+

{{- partial "svg.html" (dict "context" . "name" "posts_single_date") }}{{ dateFormat .Site.Params.dateformNumTime .Date.Local -}} + {{- if or (eq .Page.Params.IgnoreLastmod nil) (not .Page.Params.IgnoreLastmod) -}} + {{- if and .GitInfo .Site.Params.gitUrl -}} + [{{- partial "svg.html" (dict "context" . "name" "posts_single_git_commit") -}}{{ .GitInfo.AbbreviatedHash -}} @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local -}}] + {{- else if not (eq .Lastmod .Date ) -}} +  [Modified : {{ dateFormat .Site.Params.dateformNumTime .Lastmod.Local -}}] + {{- else -}} + {{ errorf ".Lastmod is not found in Page Frontmatter or .Lastmod is same as .Date" }} + {{- end -}} + {{- end -}}

- {{- if and .GitInfo .Site.Params.gitUrl }} -

{{ .GitInfo.AbbreviatedHash }} @ {{ dateFormat .Site.Params.dateformNum .GitInfo.AuthorDate.Local }}

- {{- end }}