Skip to content

Commit

Permalink
QoL changes and some re-organization
Browse files Browse the repository at this point in the history
  • Loading branch information
1bl4z3r committed Jan 12, 2025
1 parent a42ca01 commit 5cc24ab
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 23 deletions.
5 changes: 1 addition & 4 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{{ $rootCtx := . }}

{{- $rootCtx := . -}}
<!DOCTYPE html>
<html lang="{{.Site.LanguageCode}}">
<head>
{{- if .Site.Params.googleTagManager -}}{{- partial "googleTagManager_head.html" . -}}{{- end -}}
{{- partial "analytics.html" . -}}
{{- partial "site-meta.html" . -}}
{{ $author := (.Params.author | default .Site.Params.author.name) -}}<meta name="author" content="{{ $author }}">
{{- with .Page.Params.description | default .Site.Params.description -}}<meta name="description" content="{{.}}">{{- end -}}
{{- partial "structure-extra.html" . -}}
{{- partial "webschema.html" . -}}
<title>{{.Title}}</title>
Expand Down
3 changes: 1 addition & 2 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ <h1>{{ .Title }}</h1>

{{- if and (ge (len (where .Site.Pages ".Params.pin" true)) 1) (.Site.Params.pinned) (not (in .Page.RelPermalink (or "tags" "categories"))) -}}
<h2>{{- .Site.Params.pinned -}}</h2>
{{$pin_name := .Site.Params.pinnedSVGname | default "pin" }}
<div class="pinned-posts-group">
<ul class="pinned-posts-list">
{{- range where .Site.Pages ".Params.pin" true }}
<li class="pinned-post-item">
{{- partial "svg.html" (dict "context" . "name" $pin_name) }}
{{- partial "svg.html" (dict "context" . "name" (.Site.Params.pinnedSVGname | default "pin")) }}
<a href="{{.Permalink}}"><span class="post-title">{{.Title}}</span></a>
</li>
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/footer.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<footer id="site-footer" class="section-inner thin {{- if ne false .Site.Params.usesAnimation }} animated fadeIn faster {{- end -}}">
<p>
&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Params.author.name }}</a>
&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a>
&#183; {{ .Site.Params.footerCopyright | safeHTML }}
{{- if not .Site.Params.footerHideThemeName -}}
&#183; Made with <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a>
Expand Down
14 changes: 8 additions & 6 deletions layouts/partials/posts_single_info.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{{- with .Params.description }}<p>{{.}}</p>{{- end }}
{{- if and .Params.author .Params.authorLink}}{{ $relreflink := relref . .Params.authorLink }}<p>{{ partial "svg.html" (dict "context" . "name" "author") }}<a href="{{ $relreflink }}" target="_blank">{{ .Params.author }}</a></p>
{{- else if and .Params.author .Site.Params.author.about }}{{ $relreflink := relref . .Site.Params.author.about }}<p>{{ partial "svg.html" (dict "context" . "name" "author") }}<a href="{{ $relreflink }}" target="_blank">{{ .Params.author }}</a></p>
{{- else if and .Site.Params.author.about .Site.Params.author.name }}{{ $relreflink := relref . .Site.Params.author.about }}<p>{{ partial "svg.html" (dict "context" . "name" "author") }}<a href="{{ $relreflink }}" target="_blank">{{ .Site.Params.author.name }}</a></p>
{{- else }}<p>{{ partial "svg.html" (dict "context" . "name" "author") }}{{ .Site.Params.author.name }}</p>
{{- end }}
{{- with $author := default .Site.Params.author.name .Params.author -}}
{{- with $authorLink := default $.Site.Params.author.about $.Page.Params.authorLink -}}
<p>{{ partial "svg.html" (dict "context" . "name" "author") }}<a href="{{ ref $.Page $authorLink }}" target="_blank">{{ $author }}</a></p>
{{- else -}}
<p>{{ partial "svg.html" (dict "context" . "name" "author") }}{{ $author }}</p>
{{- end -}}
{{- end -}}
{{- with .Params.tags }}
<p>{{- partial "svg.html" (dict "context" . "name" "posts_single_tags") -}}{{- range . -}}<span class="tag"><a href="{{ "tags/" | absLangURL }}{{ . | urlize }}">{{.}}</a></span>{{- end }}</p>
{{- end }}
{{- with .Params.categories }}
<p>{{- partial "svg.html" (dict "context" . "name" "posts_single_categories") -}}{{- range . -}}<span class="category"><a href="{{ "categories/" | absLangURL }}{{ . | urlize }}">{{.}}</a></span>{{- end }}</p>
{{- end }}
<p>{{- partial "svg.html" (dict "context" . "name" "posts_single_wordcount") }}{{ .WordCount }} {{ if fileExists "i18n" -}} {{ i18n "wordCount" . -}} {{- else -}} Words {{- end -}} {{- partial "readTime.html" . -}}</p>
<p>{{- partial "svg.html" (dict "context" . "name" "posts_single_wordcount") }}{{- .WordCount }} {{- if fileExists "i18n" }} {{ i18n "wordCount" . -}} {{- else -}} Words {{- end }} {{ partial "readTime.html" . -}}</p>
<p>{{- partial "svg.html" (dict "context" . "name" "posts_single_date") }}{{ dateFormat .Site.Params.dateformNumTime .Date.Local -}}
{{- if and (not (eq .Page.Params.ShowLastmod nil)) (.Page.Params.ShowLastmod) -}}
{{- if and .GitInfo .Site.Params.gitUrl -}}
Expand Down
14 changes: 7 additions & 7 deletions layouts/partials/readTime.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- 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 .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 }}
{{ end -}}
2 changes: 1 addition & 1 deletion layouts/partials/single-footer.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p>
&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Params.author.name }}</a> &#183; {{ .Site.Params.footerCopyright | safeHTML }}
&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a> &#183; {{ .Site.Params.footerCopyright | safeHTML }}
{{- with .OutputFormats.Get "RSS" }}
&#183; <a href="{{ "index.xml" | absLangURL }}" target="_blank" title="rss">{{- partial "svg.html" (dict "context" . "name" "rss") -}}</a>
{{- end -}}
Expand Down
4 changes: 3 additions & 1 deletion layouts/partials/site-meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
{{- else -}}
<meta name="robots" content="{{ .Site.Params.allowRobots | default "index, follow" }}">
{{- end -}}
<link rel="author" href="{{"humans.txt" | relURL}}">
<meta name="author" content="{{ .Params.author | default .Site.Params.author.name }}">
<meta name="description" content="{{ .Page.Params.description | default .Site.Params.description }}">
<link rel="author" type="text/plain" href="{{"humans.txt" | relURL}}">
<link rel="apple-touch-icon" sizes="180x180" href="{{"apple-touch-icon.png" | relURL}}">
{{- if (fileExists "static/favicon.ico") -}}
<link rel="icon" href="{{"favicon.ico" | relURL}}" type="image/x-icon">
Expand Down
1 change: 0 additions & 1 deletion layouts/partials/structure-extra.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{{/* We use some Hugo built-in templates, you can find their source here: */}}
{{/* https://github.com/gohugoio/hugo/tree/master/tpl/tplimpl/embedded/templates */}}

{{- template "_internal/schema.html" . -}}
{{- template "_internal/opengraph.html" . -}}
{{- template "_internal/twitter_cards.html" . -}}

0 comments on commit 5cc24ab

Please sign in to comment.