diff --git a/.gitignore b/.gitignore index b6408e1..5d739f1 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ /resources/ /.env /.direnv/ - +/.certificates/ diff --git a/config/_default/hugo.toml b/config/_default/hugo.toml index f7f30ab..68b8f4a 100644 --- a/config/_default/hugo.toml +++ b/config/_default/hugo.toml @@ -7,20 +7,32 @@ languageCode = "en" DefaultContentLanguage = "en" enableInlineShortcodes = true +# define gemini media type +[mediaTypes] + [mediaTypes.'text/gemini'] + suffixes = ["gmi"] + # Automatically add content sections to main menu # sectionPagesMenu = "main" [outputs] - home = ['html', 'rss'] + home = ['html', 'rss', 'gemini'] section = ['html'] - taxonomy = ['html',] + taxonomy = ['html'] term = ['html', 'rss'] + page = ['html', 'rss', 'gemini'] # rename rss output from index.xml to feed.xml [outputFormats] [outputFormats.rss] mediatype = "application/rss" baseName = "feed" + [outputFormats.gemini] + mediatype = "text/gemini" + isPlainText = true + isHTML = false + protocol = "gemini://" + permalinkable = true [permalinks] posts = ":filename" diff --git a/content/404.md b/content/404.md index 03637e1..2b42a62 100644 --- a/content/404.md +++ b/content/404.md @@ -7,6 +7,7 @@ kudos = false +++ We're not sure what you were looking for but it's not here. + ![Animated GIF from the movie "The Naked Gun". A man in the foreground proclaims "Please disperse. Nothing to see here." while a building explodes in the background.](/images/nothing-to-see-here.gif) Maybe head back [home](/)? diff --git a/content/about.md b/content/about.md index b6505ce..76f2acb 100644 --- a/content/about.md +++ b/content/about.md @@ -5,6 +5,7 @@ timeless = true comments = false aliases = ["tldr", "bio"] +++ + ![Me, +/- a few decades](/images/john.jpg) You've (somehow) managed to stumble upon my dark corner of the internet[^1]. @@ -36,7 +37,5 @@ Connect with me via: - [XMPP](https://conversations.im/i/jbowdre@omg.lol?omemo-sid-1374125881=a620f3c57733601a6646f6f13a71c86fc9be8dd4126fd158ef3e0a26beb0b434) - [Electronic Mail](mailto:jbowdre@omg.lol) - [PGP: 613F B70C 4FA7 A077](https://l.runtimeterror.dev/pgp) - - [^1]: Congrats? And also, *thank you.* -[^2]: A bit. I'm still in the "fake it until you make" it phase of adulthood. \ No newline at end of file +[^2]: A bit. I'm still in the "fake it until you make" it phase of adulthood. diff --git a/flake.nix b/flake.nix index 2ebfeec..2f3f05d 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,7 @@ { devShells.x86_64-linux.default = pkgs.mkShell { packages = with pkgs; [ + agate go hugo nodePackages.npm diff --git a/layouts/_default/index.gmi b/layouts/_default/index.gmi new file mode 100644 index 0000000..a3bea3d --- /dev/null +++ b/layouts/_default/index.gmi @@ -0,0 +1,7 @@ +## [runtimeterror $] +{{ $pages := .Pages -}} +{{ $pages = where site.RegularPages "Type" "in" site.Params.mainSections -}} + +{{ range $pages }} +=> {{ .RelPermalink }} [{{ .Date.Format "2006-01-02" }}] {{ .Title }} +{{- end }} diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi new file mode 100644 index 0000000..698f39f --- /dev/null +++ b/layouts/_default/single.gmi @@ -0,0 +1,41 @@ +=> / 🏡 [runtimeterror $] + +# {{ .Title }}{{ $scratch := newScratch }} +{{ $content := .RawContent -}} +{{ $content := $content | replaceRE `#### ` "### " -}} +{{ $content := $content | replaceRE `\n- (.+?)` "\n* $1" -}} +{{ $content := $content | replaceRE `\n(\d+). (.+?)` "\n* $2" -}} +{{ $content := $content | replaceRE `\[\^(.+?)\]:.*\n?\n` "" -}} +{{ $content := $content | replaceRE `\[\^(.+?)\]` "" -}} +{{ $content := $content | replaceRE `
` "\n" -}} +{{ $content := $content | replaceRE `\{\{%\s\/?notice.*%\}\}` "***" -}} +{{ $content := $content | replaceRE `((\/\/)|#)\s*torchlight!.*` "" -}} +{{ $content := $content | replaceRE `` "" -}} +{{ $content := $content | replaceRE `\/\/\s*\[tl!.*\]` "" -}} +{{ $content := $content | replaceRE `#\s*\[tl!.*\]` "" -}} +{{ $content := $content | replaceRE `(.+?)` "[$2]($1)" -}} +{{ $content := $content | replaceRE `\sgemini://(\S*)` " [gemini://$1](gemini://$1)" -}} +{{/* $content := $content | replaceRE "([^`])<.*?>([^`])" "$1$2" -*/}} +{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?) \"(.+?)\"\)` "\n\n=> $1 Image: $2" -}} +{{ $content := $content | replaceRE `\n?\n!\[.*\]\((.+?)\)` "\n\n=> $1 Embedded Image: $1" -}} +{{ $links := findRE `\n=> ` $content }}{{ $scratch.Set "ref" (add (len $links) 1) }} +{{ $refs := findRE `\[.+?\]\(.+?\)` $content }} +{{ $scratch.Set "content" $content }}{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $contentInLoop := $scratch.Get "content" }}{{ $url := (printf "%s #%d" . $ref) }}{{ $contentInLoop := replace $contentInLoop . $url -}}{{ $scratch.Set "content" $contentInLoop }}{{ $scratch.Set "ref" (add $ref 1) }}{{ end }}{{ $content := $scratch.Get "content" | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$1 [$3]" -}} +{{ $content | safeHTML }} + +--- +Written by John Bowdre {{ if .Params.Date }} on {{ .Lastmod.Format "2006-01-02" }}.{{ end}} + +## Links +{{ $scratch.Set "ref" (add (len $links) 1) }}{{ range $refs }}{{ $ref := $scratch.Get "ref" }}{{ $url := (printf "%s #%d" . $ref) }} +=> {{ $url | replaceRE `\[(.+?)\]\((.+?)\) #(\d+)` "$2 [$3] $1 ($2)" -}} +{{ $scratch.Set "ref" (add $ref 1) }}{{ end}} +{{ $related := first 3 (where (where .Site.RegularPages.ByDate.Reverse ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" .Permalink) }} +{{ if $related }} +## Related articles +{{ range $related }} +=> {{ replace .RelPermalink "/gemini" "" 1}} {{ .Title }}{{ end }}{{ end }} +--- + +=> / Back to the Index +=> https://runtimeterror.dev{{ replace (replace .RelPermalink "/gemini" "" 1) "index.gmi" "" }} View this article on the WWW \ No newline at end of file