diff options
author | Timmy Keller <tjk@tjkeller.xyz> | 2024-08-10 21:03:16 -0500 |
---|---|---|
committer | Timmy Keller <tjk@tjkeller.xyz> | 2024-08-10 21:03:16 -0500 |
commit | f49d28caa3005c608eec9f8f82b1d9625ae37c01 (patch) | |
tree | 3538601cd4ac385e70517f6732290b09c806f936 /layouts | |
download | hugo-theme-tjkbasic-f49d28caa3005c608eec9f8f82b1d9625ae37c01.tar.xz hugo-theme-tjkbasic-f49d28caa3005c608eec9f8f82b1d9625ae37c01.zip |
initial commit
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/_markup/render-link.html | 1 | ||||
-rw-r--r-- | layouts/_default/baseof.html | 32 | ||||
-rw-r--r-- | layouts/_default/list.html | 11 | ||||
-rw-r--r-- | layouts/_default/single.html | 20 | ||||
-rw-r--r-- | layouts/shortcodes/img.html | 34 |
5 files changed, 98 insertions, 0 deletions
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html new file mode 100644 index 0000000..f04b2e3 --- /dev/null +++ b/layouts/_default/_markup/render-link.html @@ -0,0 +1 @@ +<a href="{{ .Destination | safeURL }}"{{ with .Title}} title="{{ . }}"{{ end }}{{ if strings.HasPrefix .Destination "http" }} target="_blank" rel="noopener"{{ end }}>{{ .Text | safeHTML }}</a> diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..e5b0ed0 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + {{ $title := print .Title " - " .Site.Title }} + {{ if .IsHome }}{{ $title = .Site.Title }}{{ end }} + <title>{{ $title | title }}</title> + <link rel="stylesheet" type="text/css" href="/stylesheets/highlight.css"> + <link rel="stylesheet" type="text/css" href="/stylesheets/style.css"> + {{- block "head" . }}{{- end }} + </head> + <body> + <header> + <a id="homelink" href="/">{{ .Site.Title }}</a> + <span id="title">{{ .Title }}</span> + <div id="menu"> + {{- range site.Menus.main }} + <a href="{{ .URL }}">{{ .Name }}</a> + {{- end }} + </div> + </header> + <main> + {{- block "main" . }}{{- end }} + </main> + <footer> + <hr> + <div id="sharing"> + <a><img src="/icons/rss_feed_24dp_78A75A_FILL0_wght400_GRAD0_opsz24.svg" /></a> + </div> + <span id="copyright">© Tim Keller 2024</span> + </footer> + </body> +</html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..06b99a2 --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,11 @@ +{{ define "main" }} + +{{ .Content }} + +<ul> + {{ range .Pages.ByPublishDate.Reverse }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} +</ul> + +{{ end }} diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..099d3fc --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,20 @@ +{{ define "main" }} + +<div id="publishing"> + <span>{{ .PublishDate | time.Format ":date_long" }}</span> + {{ if and (isset .Params "lastmod") (ne .Lastmod .PublishDate) }} + <br> + <span>Revised: {{ .Lastmod | time.Format ":date_long" }}</span> + {{ end }} + {{ if isset .Params "tags" }} + <br> + <span>Tags:</span> + {{- range sort .Params.tags }} + <a href="/tags/{{ . }}">{{ . | humanize | title }}</a> + {{- end }} + {{ end }} +</div> + +{{ .Content }} + +{{ end }} diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html new file mode 100644 index 0000000..65ca44f --- /dev/null +++ b/layouts/shortcodes/img.html @@ -0,0 +1,34 @@ +<!-- https://gohugo.io/content-management/image-processing/ --> + +<!-- Get image --> +{{ $image := resources.GetMatch (.Get "src") }} + +<!-- Get parameters --> +{{ $alt := .Get "alt" | default "" }} +{{ $rotation := .Get "rotation" | default 0 }} + +<!-- Get quality --> +{{ $quality := .Get "quality" | default "original" }} + +{{ $q := 0 }} +{{ $size := 0 }} +{{ if eq $quality "low" }} + {{ $q = 60 }} + {{ $size = 600 }} +{{ else if eq $quality "medium" }} + {{ $q = 75 }} + {{ $size = 1000 }} +{{ else if eq $quality "high" }} + {{ $q = 90 }} + {{ $size = 1200 }} +{{ end }} + + +<!-- Make image --> +{{ if ne $quality "original" }} + {{ $image = $image.Resize (printf "%dx q%d r%d" $size $q $rotation) }} +{{ end }} +<figure> + <img src="{{ $image.RelPermalink }}" title="{{ $alt }}" alt="{{ $alt }}" /> + <figcaption>{{ $alt }}</figcaption> +</figure> |