From 7aa9bdd5653fb01539e032f89d081aefccd25b578dc9de9626d06e4e6dd8bb29 Mon Sep 17 00:00:00 2001 From: Nicholas Johnson Date: Sat, 30 Apr 2022 00:00:00 +0000 Subject: Output Gemini --- layouts/_default/baseof.gmi | 4 ++++ layouts/_default/single.gmi | 6 ++++++ layouts/index.gmi | 10 ++++++++++ layouts/partials/footer.gmi | 2 ++ layouts/partials/header.gmi | 3 +++ layouts/partials/metadata.gmi | 11 +++++++++++ 6 files changed, 36 insertions(+) create mode 100644 layouts/_default/baseof.gmi create mode 100644 layouts/_default/single.gmi create mode 100644 layouts/index.gmi create mode 100644 layouts/partials/footer.gmi create mode 100644 layouts/partials/header.gmi create mode 100644 layouts/partials/metadata.gmi diff --git a/layouts/_default/baseof.gmi b/layouts/_default/baseof.gmi new file mode 100644 index 0000000..3ef51c1 --- /dev/null +++ b/layouts/_default/baseof.gmi @@ -0,0 +1,4 @@ +{{ partial "header.gmi" . }} +{{ block "main" . }}{{ end }} + +{{ partial "footer.gmi" . -}} diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi new file mode 100644 index 0000000..9681f92 --- /dev/null +++ b/layouts/_default/single.gmi @@ -0,0 +1,6 @@ +{{ define "main" }} +=> ./{{ replaceRE ".+?/" "../" .RelPermalink }} Return to homepage + +{{ $content := .RawContent }} +{{- $content = $content | replaceRE `\[(.+?)\]\((.+?)\)` "=> $2 $1" }} +{{- $content }}{{ end }} diff --git a/layouts/index.gmi b/layouts/index.gmi new file mode 100644 index 0000000..434fae5 --- /dev/null +++ b/layouts/index.gmi @@ -0,0 +1,10 @@ +{{ define "main" }} +# {{ .Site.Params.indexTitle }} +{{ .Site.Params.indexIntro }} + +## Navigation Links +{{ range .Site.Menus.main -}} +=> .{{ .URL }} {{ .Name }} +{{ end }} +## Journal Entries +{{ partial "metadata.gmi" . }}{{ end }} diff --git a/layouts/partials/footer.gmi b/layouts/partials/footer.gmi new file mode 100644 index 0000000..3c95b3f --- /dev/null +++ b/layouts/partials/footer.gmi @@ -0,0 +1,2 @@ +Unless otherwise noted, the writing in this journal is licensed under {{ $.Site.Copyright }} +Copyright {{ .Site.Params.beginCopyrightYear }}-{{ now.Format "2006" }} {{ $.Site.Author.name }} diff --git a/layouts/partials/header.gmi b/layouts/partials/header.gmi new file mode 100644 index 0000000..e060cd0 --- /dev/null +++ b/layouts/partials/header.gmi @@ -0,0 +1,3 @@ +```nicksphere logo +{{ $.Site.Params.logo }} +``` diff --git a/layouts/partials/metadata.gmi b/layouts/partials/metadata.gmi new file mode 100644 index 0000000..3984494 --- /dev/null +++ b/layouts/partials/metadata.gmi @@ -0,0 +1,11 @@ +{{ $entriesMinusOne := sub (len (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse) 1 }} +{{- range first $entriesMinusOne (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }} +{{- $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" }} +{{- .PublishDate.Format $dateFormat }} - {{ .ReadingTime }} minute read +=> .{{ .RelPermalink }} {{ .Title }} + +{{ end }} +{{- range last 1 (where .Site.RegularPages.ByTitle "Section" "entry").ByPublishDate.Reverse }} +{{- $dateFormat := .Site.Params.dateFormat | default "2 Jan 2006" }} +{{- .PublishDate.Format $dateFormat }} - {{ .ReadingTime }} minute read +=> .{{ .RelPermalink }} {{ .Title }}{{ end }} -- cgit v1.2.3