From 9bb9989fca490bfac69ea4387ccae1e9ec3ec23cf7f47a401e241ee43562f8a3 Mon Sep 17 00:00:00 2001
From: Nicholas Johnson <>
Date: Sat, 26 Jul 2025 00:00:00 +0000
Subject: Migrate fully to Hugo's new template system
This was the only way I could get term pages to consistently render
correctly.
---
layouts/_default/_markup/render-image.html | 1 -
layouts/_default/_markup/render-link.html | 3 -
layouts/_default/baseof.gmi | 7 --
layouts/_default/baseof.html | 9 --
layouts/_default/single.gmi | 132 -----------------------------
layouts/_default/single.html | 12 ---
layouts/_default/taxonomy.atom.xml | 56 ------------
layouts/_default/taxonomy.gemini_atom.xml | 55 ------------
layouts/_default/taxonomy.gmi | 17 ----
layouts/_default/taxonomy.html | 16 ----
layouts/_default/term.atom.xml | 56 ------------
layouts/_default/term.gemini_atom.xml | 55 ------------
layouts/_default/term.gmi | 19 -----
layouts/_default/term.html | 14 ---
14 files changed, 452 deletions(-)
delete mode 100644 layouts/_default/_markup/render-image.html
delete mode 100644 layouts/_default/_markup/render-link.html
delete mode 100644 layouts/_default/baseof.gmi
delete mode 100644 layouts/_default/baseof.html
delete mode 100644 layouts/_default/single.gmi
delete mode 100644 layouts/_default/single.html
delete mode 100644 layouts/_default/taxonomy.atom.xml
delete mode 100644 layouts/_default/taxonomy.gemini_atom.xml
delete mode 100644 layouts/_default/taxonomy.gmi
delete mode 100644 layouts/_default/taxonomy.html
delete mode 100644 layouts/_default/term.atom.xml
delete mode 100644 layouts/_default/term.gemini_atom.xml
delete mode 100644 layouts/_default/term.gmi
delete mode 100644 layouts/_default/term.html
(limited to 'layouts/_default')
diff --git a/layouts/_default/_markup/render-image.html b/layouts/_default/_markup/render-image.html
deleted file mode 100644
index 590c9bf..0000000
--- a/layouts/_default/_markup/render-image.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/layouts/_default/_markup/render-link.html b/layouts/_default/_markup/render-link.html
deleted file mode 100644
index 8fb3c26..0000000
--- a/layouts/_default/_markup/render-link.html
+++ /dev/null
@@ -1,3 +0,0 @@
-{{ $emoji := cond (and (not (.Page.Params.makerefs | default true)) (.Page.Params.showlinkemoji | default true)) (emojify ":link: ") "" -}}
-{{ $isExternalLink := (urls.Parse .Destination).IsAbs -}}
-{{ $emoji }}{{ .Text }}
\ No newline at end of file
diff --git a/layouts/_default/baseof.gmi b/layouts/_default/baseof.gmi
deleted file mode 100644
index 09cdbac..0000000
--- a/layouts/_default/baseof.gmi
+++ /dev/null
@@ -1,7 +0,0 @@
-{{ partial "header.gmi" . }}
-
-
-{{ block "main" . }}{{ end }}
-
-
-{{ partial "footer.gmi" . }}
\ No newline at end of file
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
deleted file mode 100644
index a36bd49..0000000
--- a/layouts/_default/baseof.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
- {{ partial "head.html" . }}
-
- {{ partial "header.html" . }}
- {{ block "main" . }}{{ end }}
- {{ partial "footer.html" . }}
-
-
\ No newline at end of file
diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi
deleted file mode 100644
index 1502830..0000000
--- a/layouts/_default/single.gmi
+++ /dev/null
@@ -1,132 +0,0 @@
-{{ define "main" -}}
-{{ $emoji := cond (.Page.Params.showlinkemoji | default true) (emojify ":link: ") "" -}}
-=> {{ .Site.Home.RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ i18n "returnHome" -}}
-
-{{ if (.Page.Params.pageinfo | default true) }}
-
-{{ partial "pageinfo.gmi" . -}}
-{{ end }}
-
-
-# {{ .Name }}
-
-{{ $content := chomp (.RawContent) -}}
-{{ $scratch := newScratch -}}
-
-{{/* if content begins with a heading, add an extra newline */ -}}
-{{ if (findRE `^#{1,6} ` $content 1) }}
-{{ end -}}
-
-{{/* split text into chunks, with each chunk containing 3 parts: above, within, and below preformatted text */ -}}
-{{/* the regex matching below the preformatted text matches exactly once in the entire text */ -}}
-{{ $chunks := findRESubmatch `(?sm)(?:(.+?)(^\x60{3}[^\x60].*?^\x60{3}$))|(.+$)` $content -}}
-
-{{ $ref_index := 0 -}}
-
-{{ range $chunks -}}
- {{ $above_pre := index . 1 -}}
- {{ $pre := index . 2 -}}
- {{ $below_pre := index . 3 -}}
-
- {{/* mux regex matches above and below preformatted text for rendering (the matches are mutually exclusive) */ -}}
- {{ $rendered_text := print $above_pre $below_pre -}}
-
- {{ if ($.Page.Params.makerefs | default true) -}}
-
- {{/* find all the links within a chunk */ -}}
- {{ $chunk_refs := findRESubmatch `!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)` $rendered_text -}}
-
- {{ range $chunk_refs -}}
- {{ $ref_index = add $ref_index 1 -}}
- {{ $chunk_ref := dict
- "index" $ref_index
- "text" (index . 1)
- "link" (index . 2)
- "title" (index . 3)
- -}}
-
- {{ $scratch.Add "refs" (slice $chunk_ref) -}}
-
- {{ $ref_index := $chunk_ref.index -}}
- {{ $ref_text := $chunk_ref.text -}}
-
- {{/* create superscript of $ref_index */ -}}
- {{ $superscript_map := dict
- "0" "⁰"
- "1" "¹"
- "2" "²"
- "3" "³"
- "4" "⁴"
- "5" "⁵"
- "6" "⁶"
- "7" "⁷"
- "8" "⁸"
- "9" "⁹"
- -}}
- {{ $ref_superscript := "" -}}
- {{ range (split $ref_index "") -}}
- {{ $ref_superscript = print $ref_superscript (index $superscript_map .) -}}
- {{ end -}}
-
- {{/* replace Markdown links with link text and their superscripted reference numbers */ -}}
- {{ $rendered_text = replace $rendered_text (index . 0) (print $ref_text $ref_superscript) 1 -}}
-
- {{ end -}}
-
- {{ else -}}
-
- {{/* render all links directly */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `(?m)^!?\[[\t ]*(.+?)[\t ]*\]\([\t ]*(.+?)(?:[\t ]+"(.+?)")?[\t ]*\)$` (print "=> $2 " $emoji "$1") -}}
-
- {{ end -}}
-
- {{/* trim extra heading symbols */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `(?m)^####{1,3} ` "### " -}}
-
- {{/* convert Markdown alternative heading syntax to gemtext heading syntax */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\=+$` "# $1" -}}
- {{ $rendered_text = $rendered_text | replaceRE `(?m)^[\t ]*(\S.+?)[\t ]*\n\-+$` "## $1" -}}
-
- {{/* convert Markdown alternative unordered list syntax to gemtext unordered list syntax */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `(?m)^[-+] ` "* " -}}
-
- {{/* convert Markdown ordered list items to gemtext unordered list items */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `(?m)^[1-9]\d*\.[\t ]+(.*?)[\t ]*$` "* $1" -}}
-
- {{/* remove bold and italics asterisk symbols */ -}}
- {{/* note: this operation is performed in 3 steps to handle nested bold and italics */ -}}
- {{/* note: this operation is performed last to avoid incorrectly rendering (un)ordered lists */ -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{3}(\S(?:.*?\S)?)\*{3}` "$1" -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{2}(\S(?:.*?\S)?)\*{2}` "$1" -}}
- {{ $rendered_text = $rendered_text | replaceRE `\*{1}(\S(?:.*?\S)?)\*{1}` "$1" -}}
-
- {{ $rendered_text = $rendered_text | emojify -}}
-
- {{/* demux regex matches above and below preformatted text */ -}}
- {{ if $above_pre -}}
- {{ $rendered_text -}}
- {{ $pre -}}
- {{ else -}}
- {{ $pre -}}
- {{ $rendered_text -}}
- {{ end -}}
-
-{{ end -}}
-
-{{ $refs := $scratch.Get "refs" -}}
-{{ if and (.Page.Params.makerefs | default true) $refs }}
-
-
-## {{ i18n "refs" }}
-{{ range $refs -}}
- {{ $ref_index := .index -}}
- {{ $ref_text := .text -}}
- {{ $ref_link := .link -}}
- {{ $ref_title := .title -}}
-
- {{/* render referenced links */}}
-{{ print "=> " $ref_link (emojify " :link: [") $ref_index "]: " (cond (ne (len $ref_title) 0) $ref_title $ref_text) -}}
-{{ end -}}
-
-{{ end -}}
-{{ end }}
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
deleted file mode 100644
index fdfa777..0000000
--- a/layouts/_default/single.html
+++ /dev/null
@@ -1,12 +0,0 @@
-{{ define "main" -}}
-
- {{ emojify ":link:" }} {{ i18n "returnHome" }}
-
-{{- if (.Page.Params.pageinfo | default true) }}
-{{ partial "pageinfo.html" . }}
-{{- end }}
-
- {{ .Name }}
- {{ chomp (.Content) }}
-
-{{- end }}
\ No newline at end of file
diff --git a/layouts/_default/taxonomy.atom.xml b/layouts/_default/taxonomy.atom.xml
deleted file mode 100644
index cbcbae8..0000000
--- a/layouts/_default/taxonomy.atom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-{{/* Deprecate site.Author.name in favor of site.Params.author.name */}}
-{{- $authorName := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .name }}
- {{- $authorName = . }}
- {{- end }}
- {{- else }}
- {{- $authorName = . }}
- {{- end }}
-{{- else }}
- {{- with site.Author.name }}
- {{- $authorName = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
- {{- end }}
-{{- end }}
-
-{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
-{{- $authorEmail := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .email }}
- {{- $authorEmail = . }}
- {{- end }}
- {{- end }}
-{{- else }}
- {{- with site.Author.email }}
- {{- $authorEmail = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
- {{- end }}
-{{- end -}}
-
-{{ "" | safeHTML }}
-
- {{ .Permalink }}
- {{ .Site.Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
-
- {{- with $authorName }}
-
- {{ . }}
- {{- with $authorEmail }}
- {{ . }} {{ end }}
- {{ end }}
- Hugo -- gohugo.io
- {{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}
- {{ .Site.Params.Description }} {{ range first .Site.Config.Services.RSS.Limit .Data.Pages }}
-
- {{ .Permalink }}
- {{ .Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
- {{ .Content | html }}
- {{ end }}
-
diff --git a/layouts/_default/taxonomy.gemini_atom.xml b/layouts/_default/taxonomy.gemini_atom.xml
deleted file mode 100644
index 76431e3..0000000
--- a/layouts/_default/taxonomy.gemini_atom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-{{/* Deprecate site.Author.name in favor of site.Params.author.name */}}
-{{- $authorName := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .name }}
- {{- $authorName = . }}
- {{- end }}
- {{- else }}
- {{- $authorName = . }}
- {{- end }}
-{{- else }}
- {{- with site.Author.name }}
- {{- $authorName = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
- {{- end }}
-{{- end }}
-
-{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
-{{- $authorEmail := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .email }}
- {{- $authorEmail = . }}
- {{- end }}
- {{- end }}
-{{- else }}
- {{- with site.Author.email }}
- {{- $authorEmail = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
- {{- end }}
-{{- end -}}
-
-{{ "" | safeHTML }}
-
- {{ .Permalink | strings.TrimSuffix "index.gmi" }}
- {{ .Site.Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
-
- {{- with $authorName }}
-
- {{ . }}
- {{- with $authorEmail }}
- {{ . }} {{ end }}
- {{ end }}
- Hugo -- gohugo.io
- {{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}
- {{ .Site.Params.Description }} {{ range first .Site.Config.Services.RSS.Limit .Data.Pages }}
-
- {{ .Permalink | strings.TrimSuffix "index.gmi" }}
- {{ .Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
- {{ end }}
-
diff --git a/layouts/_default/taxonomy.gmi b/layouts/_default/taxonomy.gmi
deleted file mode 100644
index 9c2a9f0..0000000
--- a/layouts/_default/taxonomy.gmi
+++ /dev/null
@@ -1,17 +0,0 @@
-{{ define "main" -}}
-=> {{ .Site.Home.RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ i18n "returnHome" }}
-
-
-# {{ .Type | humanize }}
-
-
-## {{ i18n "feeds" }}
-
-=> {{ .RelPermalink | replaceRE `index.gmi$` "atom.xml" }} {{ emojify ":link:" }} {{ i18n "atomFeed" }}
-
-
-## {{ i18n "list" }}
-{{ range .Data.Pages }}
-=> {{ .RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ .Title -}}
-{{ end -}}
-{{ end }}
\ No newline at end of file
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html
deleted file mode 100644
index 86d7f89..0000000
--- a/layouts/_default/taxonomy.html
+++ /dev/null
@@ -1,16 +0,0 @@
-{{ define "main" -}}
-
- {{ emojify ":link:" }} {{ i18n "returnHome" }}
-
-
- {{ .Type | humanize }}
- {{ i18n "feeds" }}
- {{ emojify ":link:" }} {{ i18n "atomFeed" }}
- {{ i18n "list" }}
-
- {{- range .Data.Pages }}
- {{ emojify ":link:" }} {{ .Title }}
- {{- end }}
-
-
-{{- end }}
\ No newline at end of file
diff --git a/layouts/_default/term.atom.xml b/layouts/_default/term.atom.xml
deleted file mode 100644
index cbcbae8..0000000
--- a/layouts/_default/term.atom.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-{{/* Deprecate site.Author.name in favor of site.Params.author.name */}}
-{{- $authorName := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .name }}
- {{- $authorName = . }}
- {{- end }}
- {{- else }}
- {{- $authorName = . }}
- {{- end }}
-{{- else }}
- {{- with site.Author.name }}
- {{- $authorName = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
- {{- end }}
-{{- end }}
-
-{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
-{{- $authorEmail := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .email }}
- {{- $authorEmail = . }}
- {{- end }}
- {{- end }}
-{{- else }}
- {{- with site.Author.email }}
- {{- $authorEmail = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
- {{- end }}
-{{- end -}}
-
-{{ "" | safeHTML }}
-
- {{ .Permalink }}
- {{ .Site.Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
-
- {{- with $authorName }}
-
- {{ . }}
- {{- with $authorEmail }}
- {{ . }} {{ end }}
- {{ end }}
- Hugo -- gohugo.io
- {{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}
- {{ .Site.Params.Description }} {{ range first .Site.Config.Services.RSS.Limit .Data.Pages }}
-
- {{ .Permalink }}
- {{ .Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
- {{ .Content | html }}
- {{ end }}
-
diff --git a/layouts/_default/term.gemini_atom.xml b/layouts/_default/term.gemini_atom.xml
deleted file mode 100644
index 287bcc4..0000000
--- a/layouts/_default/term.gemini_atom.xml
+++ /dev/null
@@ -1,55 +0,0 @@
-{{/*Deprecate site.Author.name in favor of site.Params.author.name */}}
-{{- $authorName := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .name }}
- {{- $authorName = . }}
- {{- end }}
- {{- else }}
- {{- $authorName = . }}
- {{- end }}
-{{- else }}
- {{- with site.Author.name }}
- {{- $authorName = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
- {{- end }}
-{{- end }}
-
-{{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
-{{- $authorEmail := "" }}
-{{- with site.Params.author }}
- {{- if reflect.IsMap . }}
- {{- with .email }}
- {{- $authorEmail = . }}
- {{- end }}
- {{- end }}
-{{- else }}
- {{- with site.Author.email }}
- {{- $authorEmail = . }}
- {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
- {{- end }}
-{{- end -}}
-
-{{ "" | safeHTML }}
-
- {{ .Permalink | strings.TrimSuffix "index.gmi" }}
- {{ .Site.Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
-
- {{- with $authorName }}
-
- {{ . }}
- {{- with $authorEmail }}
- {{ . }} {{ end }}
- {{ end }}
- Hugo -- gohugo.io
- {{ replace .Site.Copyright "{currentYear}" (now.Format "2006") }}
- {{ .Site.Params.Description }} {{ range first .Site.Config.Services.RSS.Limit .Data.Pages }}
-
- {{ .Permalink | strings.TrimSuffix "index.gmi" }}
- {{ .Title }}
- {{ .Date.Format "2006-01-02T15:04:05-0700" | safeHTML }}
-
- {{ end }}
-
diff --git a/layouts/_default/term.gmi b/layouts/_default/term.gmi
deleted file mode 100644
index 5d7f7b1..0000000
--- a/layouts/_default/term.gmi
+++ /dev/null
@@ -1,19 +0,0 @@
-{{ define "main" -}}
-=> {{ .Site.Home.RelPermalink | strings.TrimSuffix "index.gmi" }} {{ emojify ":link:" }} {{ i18n "returnHome" }}
-
-
-# {{ .Type | singularize | humanize }} "{{ .Title }}"
-
-
-## {{ i18n "feeds" }}
-
-=> {{ .RelPermalink | replaceRE `index.gmi$` "atom.xml" }} {{ emojify ":link:" }} {{ i18n "atomFeed" }}
-
-
-## {{ i18n "journalEntries" -}}
-
-{{ range .Data.Pages.ByPublishDate.Reverse }}
-
-{{ partial "metadata.gmi" . -}}
-{{ end -}}
-{{ end }}
\ No newline at end of file
diff --git a/layouts/_default/term.html b/layouts/_default/term.html
deleted file mode 100644
index 3b268dd..0000000
--- a/layouts/_default/term.html
+++ /dev/null
@@ -1,14 +0,0 @@
-{{ define "main" -}}
-
- {{ emojify ":link:" }} {{ i18n "returnHome" }}
-
-
- {{ .Type | singularize | humanize }} "{{ .Title }}"
- {{ i18n "feeds" }}
- {{ emojify ":link:" }} {{ i18n "atomFeed" }}
- {{ i18n "journalEntries" }}
- {{- range .Data.Pages.ByPublishDate.Reverse }}
- {{ partial "metadata.html" . -}}
- {{ end }}
-
-{{- end }}
\ No newline at end of file
--
cgit v1.2.3