From a13cbbe5d7698a8b9b5df5e9ab90f35c6ae0dfd7 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Tue, 29 Jun 2021 12:55:08 +0100 Subject: [PATCH] Improvements --- Makefile | 1 + config.toml | 3 ++- content/_index.gmi | 1 - content/logs/_index.gmi | 4 +-- content/logs/first-post.gmi | 8 ------ content/logs/first-post.md | 6 +++++ content/notes/_index.gmi | 5 ++++ content/notes/kiln.md | 47 ++++++++++++++++++++++++++++++++++++ templates/_default/index.gmi | 1 + templates/_default/page.gmi | 5 ++-- templates/index.gmi | 8 ++++++ templates/logs/index.gmi | 7 ++++++ 12 files changed, 81 insertions(+), 15 deletions(-) delete mode 100644 content/logs/first-post.gmi create mode 100644 content/logs/first-post.md create mode 100644 content/notes/_index.gmi create mode 100644 content/notes/kiln.md create mode 100644 templates/index.gmi create mode 100644 templates/logs/index.gmi diff --git a/Makefile b/Makefile index b171f77..bed7805 100644 --- a/Makefile +++ b/Makefile @@ -15,4 +15,5 @@ clean: .PHONY: build build: ${HOME}/bin/kiln build + mkdir -p $(DESTDIR)/ cp -R public/* $(DESTDIR)/ diff --git a/config.toml b/config.toml index 4a73d06..34cda6b 100644 --- a/config.toml +++ b/config.toml @@ -8,8 +8,9 @@ urls = ["gemini://dimension.sh/~nikdoof"] "/logs/" = "/logs/{{ .Date.Format `2006/01/02` }}/{{ path.Base .Permalink }}/" [[tasks]] -input = [".gmi"] +input = [".gmi", ".md"] output = ".gmi" template = ".gmi" static_dir = "static" output_dir = "public" +preprocess.md = "md2gmn" diff --git a/content/_index.gmi b/content/_index.gmi index 301e25b..8fe628a 100644 --- a/content/_index.gmi +++ b/content/_index.gmi @@ -2,4 +2,3 @@ title: nikdoof's capsule --- -=> /~nikdoof/logs/ Logs \ No newline at end of file diff --git a/content/logs/_index.gmi b/content/logs/_index.gmi index 9e3d71d..4d38ec1 100644 --- a/content/logs/_index.gmi +++ b/content/logs/_index.gmi @@ -1,5 +1,3 @@ --- -title: logs +title: Logs --- - -The inane ramblings of nikdoof, sysop of dimension.sh. diff --git a/content/logs/first-post.gmi b/content/logs/first-post.gmi deleted file mode 100644 index 7869eb5..0000000 --- a/content/logs/first-post.gmi +++ /dev/null @@ -1,8 +0,0 @@ ---- -title: First Post -date: 2021-06-29 ---- - -I've been meaning for a while to create a gemblog, or capsule, however you want to call it. I got tied up with process and spent far too much time trying to convert my existing Hugo website (nikdoof.com) to a Gemini site, as it turns out its a extremely difficult problem to solve and not one that can be done in a quick weekend. So with that I decided to just create a small, rambling log here, different from my main site's content. - -=> https://nikdoof.com nikdoof.com \ No newline at end of file diff --git a/content/logs/first-post.md b/content/logs/first-post.md new file mode 100644 index 0000000..314bef8 --- /dev/null +++ b/content/logs/first-post.md @@ -0,0 +1,6 @@ +--- +title: First Post +date: 2021-06-29 +--- + +I've been meaning for a while to create a gemblog, or capsule, however you want to call it. I got tied up with process and spent far too much time trying to convert my existing Hugo website ([nikdoof.com](https://nikdoof.com)) to a Gemini site, as it turns out its a extremely difficult problem to solve and not one that can be done in a quick weekend. So with that I decided to just create a small, rambling log here, different from my main site's content. diff --git a/content/notes/_index.gmi b/content/notes/_index.gmi new file mode 100644 index 0000000..461e08e --- /dev/null +++ b/content/notes/_index.gmi @@ -0,0 +1,5 @@ +--- +title: Notes +--- + +A collection of notes made about various, Gemini-related, tasks and applications. \ No newline at end of file diff --git a/content/notes/kiln.md b/content/notes/kiln.md new file mode 100644 index 0000000..f17b13e --- /dev/null +++ b/content/notes/kiln.md @@ -0,0 +1,47 @@ +--- +title: Kiln +--- + +[Kiln](https://git.sr.ht/~adnano/kiln) is a simple static site generator aimed at Gemini use foremost, but it can be configured to support HTML and potentially Gopher. It supports using external tools as pre/post processors, allowing you to manipulate any file format int something it can use. + +## Documentation + +[https://git.sr.ht/~adnano/kiln/tree/master/item/docs/kiln.1.scd](Kiln Man Page) +[Introduction](https://kiln.adnano.co) +[kiln-discuss mailing list](https://lists.sr.ht/~adnano/kiln-discuss) + +## Iterating Subfolders on Templates + +Not described too much in the documentation, but you can use the `.Dirs` value passed to index templates to iterate down into the folders and list pages within the folders. + +``` +{{ range .Dirs }}## {{.Title }} +{{ range .Pages }}=> {{ .Permalink }} {{ if not .Date.IsZero -}} +{{.Date.Format "2006-01-02"}} {{end}}{{.Title}} +{{ end }} +{{ end -}} +``` + +Produces + +``` +## Logs +=> /~nikdoof/logs/2021/06/29/first-post/ 2021-06-29 First Post + +## Notes +=> /~nikdoof/notes/kiln/ Kiln +``` + +## Handling Markdown + +Adding `preprocess.md` value to your tasks and adding `.md` to the input formats allows you to use Markdown files for generating out Gemini. + +``` +[[tasks]] +input = [".gmi", ".md"] +output = ".gmi" +template = ".gmi" +static_dir = "static" +output_dir = "public" +preprocess.md = "md2gmn" +``` \ No newline at end of file diff --git a/templates/_default/index.gmi b/templates/_default/index.gmi index 802f013..e573970 100644 --- a/templates/_default/index.gmi +++ b/templates/_default/index.gmi @@ -1,6 +1,7 @@ # {{ .Title }} {{ if .Content }} {{ .Content }}{{ end }} + {{ range .Pages }}=> /~nikdoof{{ .Permalink }} {{ if not .Date.IsZero -}} {{.Date.Format "2006-01-02"}} {{end}}{{.Title}} {{ end -}} diff --git a/templates/_default/page.gmi b/templates/_default/page.gmi index c9de13a..57d11a0 100644 --- a/templates/_default/page.gmi +++ b/templates/_default/page.gmi @@ -1,5 +1,6 @@ # {{ .Title }} -{{- if not .Date.IsZero }} -Posted on {{ .Date.Format "2006-01-02" }}{{ end }} {{ .Content }} + +{{- if not .Date.IsZero }} +Posted on {{ .Date.Format "2006-01-02" }}{{ end }} \ No newline at end of file diff --git a/templates/index.gmi b/templates/index.gmi new file mode 100644 index 0000000..8a44ffe --- /dev/null +++ b/templates/index.gmi @@ -0,0 +1,8 @@ +# {{ .Title }} +{{ if .Content }} +{{ .Content }}{{ end }} +{{ range .Dirs }}## {{.Title }} +{{ range .Pages }}=> /~nikdoof{{ .Permalink }} {{ if not .Date.IsZero -}} +{{.Date.Format "2006-01-02"}} {{end}}{{.Title}} +{{ end }} +{{ end -}} diff --git a/templates/logs/index.gmi b/templates/logs/index.gmi new file mode 100644 index 0000000..5f280cd --- /dev/null +++ b/templates/logs/index.gmi @@ -0,0 +1,7 @@ +# {{ .Title }} +{{ if .Content -}} +{{ .Content }}{{ end }} +{{ range .Pages }}=> /~nikdoof{{ .Permalink }} {{ if not .Date.IsZero -}} +{{.Date.Format "2006-01-02"}} {{end}}{{.Title}} +{{ end }} +=> /~nikdoof{{ .Permalink }}atom.xml Atom Feed \ No newline at end of file