From 55db714561d6279b3e2971bd920a29d3900b0067 Mon Sep 17 00:00:00 2001 From: earnest ma Date: Tue, 9 Feb 2021 17:09:17 -0500 Subject: [PATCH] feat: Add support for gemini Closes #1 Closes #2 --- layouts/_default/list.html | 21 ++++++++++----------- layouts/_default/single.gmi | 19 +++++++++++++++++++ layouts/blog/single.gmi | 30 ++++++++++++++++++++++++++++++ layouts/blog/single.html | 18 ++++++++++-------- layouts/index.gmi | 14 ++++++++++++++ 5 files changed, 83 insertions(+), 19 deletions(-) create mode 100644 layouts/_default/single.gmi create mode 100644 layouts/blog/single.gmi create mode 100644 layouts/index.gmi diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 80964f2..4862711 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -17,21 +17,20 @@ {{ if .Data.Singular }} diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi new file mode 100644 index 0000000..24ac0e6 --- /dev/null +++ b/layouts/_default/single.gmi @@ -0,0 +1,19 @@ +# {{ $.Title | safeHTML }} + +{{ trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML }} + +```ASCII + . + ,O, + ,OOO, + 'oooooOOOOOooooo' + `OOOOOOOOOOO` + `OOOOOOO` + OOOO'OOOO + OOO' 'OOO + O' 'O +``` + +=> / Return to the homepage + +{{ .Site.Copyright }} diff --git a/layouts/blog/single.gmi b/layouts/blog/single.gmi new file mode 100644 index 0000000..ae72845 --- /dev/null +++ b/layouts/blog/single.gmi @@ -0,0 +1,30 @@ +# {{ $.Title | safeHTML }} + +{{ if .Lastmod }}{{ if not (eq .Lastmod .Date )}} +Published on {{ .Date.Format "Jan 02, 2006" }}, updated {{ dateFormat "2006-01-02" .Lastmod.Local }}. +{{ end }} +{{ else }} +Published on {{ .Date.Format "Jan 02, 2006" }}. +{{ end }} + +{{ trim (readFile (replace $.File.Path ".md" ".gmi")) "\n" | safeHTML }} + +```ASCII + * . * . , * + . . . * + * . .' * , . . , * + . * .' + ' . . * * .'. + . ' ' . . ' . +. * , * ' * + . + * . * +``` + +=> / Return to the homepage +{{ with .OutputFormats.Get "html" }} +=> {{ .Permalink }} See “{{ $.Title | safeHTML }}” on the WWW +{{ end }} +{{ with .Params.comments }}=> https://{{ .host }}/@{{ .user }}/{{ .id }} You may comment here{{ end }} + +{{ .Site.Copyright }} diff --git a/layouts/blog/single.html b/layouts/blog/single.html index 7135707..542ca44 100644 --- a/layouts/blog/single.html +++ b/layouts/blog/single.html @@ -1,21 +1,23 @@ {{ define "main" }}

{{ .Title }}

-

- • Published on -

{{ .Content }} diff --git a/layouts/index.gmi b/layouts/index.gmi new file mode 100644 index 0000000..d8476f8 --- /dev/null +++ b/layouts/index.gmi @@ -0,0 +1,14 @@ +{{ trim (readFile (replace (replace $.File.Path ".md" ".gmi") ".html" ".gmi")) "\n" | safeHTML }} + +## Blog Posts + +{{ with .OutputFormats.Get "html" }} +=> {{ .Permalink }} More posts on WWW +{{ end }} + +{{ range (where .Site.RegularPages "Section" "blog") }} +{{- if .OutputFormats.Get "gemtext" }} +=> {{ replace .Permalink "/gemini" "" 1 }} {{ .Date.Format "Jan 02, 2006" }}: {{ .Title | safeHTML }}{{ end }}{{ end }} + + +{{ .Site.Copyright }}