diff options
author | Patrick Spek <p.spek@tyil.nl> | 2023-07-23 18:50:51 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2023-07-23 18:50:51 +0200 |
commit | 05bcb583f05c49d6ecd793b1fcdd0242930a1f96 (patch) | |
tree | 613cfa7a6b561009d74fbe67f5c04f68ea87d641 | |
parent | cc2713533d4c2fc75960dfe1767497050bfef516 (diff) |
Add gemini output supportgemini
-rw-r--r-- | config.toml | 20 | ||||
-rw-r--r-- | layouts/_default/baseof.gmi | 48 | ||||
-rw-r--r-- | layouts/_default/list.gmi | 11 | ||||
-rw-r--r-- | layouts/_default/single.gmi | 10 | ||||
-rw-r--r-- | layouts/_default/term.gmi | 19 | ||||
-rw-r--r-- | layouts/home.gmi | 21 | ||||
-rw-r--r-- | layouts/posts/list.gmi | 20 | ||||
-rw-r--r-- | layouts/posts/single.gmi | 33 |
8 files changed, 182 insertions, 0 deletions
diff --git a/config.toml b/config.toml index 3a6a07e..c7ecabd 100644 --- a/config.toml +++ b/config.toml @@ -9,5 +9,25 @@ noClasses = false codeFences = true tabwidth = 8 +[mediaTypes."text/gemini"] +suffixes = ["gmi"] + +[outputFormats.GEMINI] +name = "GEMINI" +isPlainText = true +isHTML = false +mediaType = "text/gemini" +protocol = "gemini://" +permalinkable = true + +[outputFormats."GEMINI_RSS"] +baseName = "feed" +mediaType = "application/rss+xml" +isPlainText = false + +[outputs] +home = ["HTML", "RSS", "GEMINI", "GEMINI_RSS"] +page = ["HTML", "GEMINI", "GEMINI_RSS"] + [permalinks] posts = "/post/:year/:month/:day/:title/" diff --git a/layouts/_default/baseof.gmi b/layouts/_default/baseof.gmi new file mode 100644 index 0000000..74338f3 --- /dev/null +++ b/layouts/_default/baseof.gmi @@ -0,0 +1,48 @@ +{{- $cssMain := resources.Get "theme/main.scss" | resources.ToCSS | fingerprint -}} +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link rel="stylesheet" type="text/css" href="{{ $cssMain.Permalink }}"> + {{- range .AlternativeOutputFormats }} + <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" title="{{ $.Site.Title }}" href="{{ .Permalink }}"> + {{- end }} + <title>{{ .Page.Title }} - {{ .Site.Title }}</title> + {{- block "head" . }} + {{- end }} + </head> + <body> + {{- block "body" . }} + <header id="site-header"> + <div class="container"> + <nav class="main"> + <a href="/" class="brand-name">{{ .Site.Title }}</a> + {{- range sort .Site.Sections "Title" }} + <a href="{{ .Permalink }}">{{ .Title }}</a> + {{- end }} + </nav> + </div> + </header> + <main id="site-main"> + <div class="container"> + {{- block "main" . }}{{ end }} + </div> + </main> + <footer id="site-footer"> + <div class="container"> + <hr> + <p>© 2016 - {{ now.Year }} – Patrick "tyil" Spek</p> + <p> + All content is licensed as per the license shown below + that content. All other sources (html, css, ...) are + released under the terms of the <a + href="https://www.gnu.org/licenses/gpl-3.0.txt">GNU GPL, + version 3</a> or later. + </p> + </div> + </footer> + {{- end }} + </body> +</html> diff --git a/layouts/_default/list.gmi b/layouts/_default/list.gmi new file mode 100644 index 0000000..6ba66fc --- /dev/null +++ b/layouts/_default/list.gmi @@ -0,0 +1,11 @@ +{{- define "main" }} +<h1>{{ .Title }}</h1> +{{ .Content }} +<ul> + {{- range .Paginator.Pages }} + <li> + <a href="{{ .Permalink }}">{{ .Title }}</a> + </li> + {{- end }} +</ul> +{{- end }} diff --git a/layouts/_default/single.gmi b/layouts/_default/single.gmi new file mode 100644 index 0000000..79dc350 --- /dev/null +++ b/layouts/_default/single.gmi @@ -0,0 +1,10 @@ +{{ define "main" }} +<article> + <header> + <h1>{{ .Title }}</h1> + </header> + <main> + {{ .Content }} + </main> +</article> +{{ end }} diff --git a/layouts/_default/term.gmi b/layouts/_default/term.gmi new file mode 100644 index 0000000..ee63c70 --- /dev/null +++ b/layouts/_default/term.gmi @@ -0,0 +1,19 @@ +{{ define "main" }} +<h1>Posts tagged with #{{ .Title }}</h1> +{{ .Content }} +<ul> + {{ range .Paginator.Pages }} + <li> + <a href="{{ .Permalink }}"> + {{ .Title }} + </a> + <small> + {{ .Date | dateFormat "2006-01-02" }} + {{- range .Params.tags }} + <a href="/tags/{{ . | lower }}">#{{ . }}</a> + {{- end }} + </small> + </li> + {{ end }} +</ul> +{{ end }} diff --git a/layouts/home.gmi b/layouts/home.gmi new file mode 100644 index 0000000..b1e0212 --- /dev/null +++ b/layouts/home.gmi @@ -0,0 +1,21 @@ +{{ define "main" }} +<article> + <header> + <h1> + {{ .Page.Title }} + </h1> + <small> + </small> + </header> + <main> + {{ .Content }} + </main> + <footer> + <p class="text-center"> + <a class="image-link" rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"> + <img alt="Creative Commons License" src="/img/cc-by-sa.png" /> + </a> + </p> + </footer> +</article> +{{ end }} diff --git a/layouts/posts/list.gmi b/layouts/posts/list.gmi new file mode 100644 index 0000000..40a0ba5 --- /dev/null +++ b/layouts/posts/list.gmi @@ -0,0 +1,20 @@ +{{- define "main" }} +<h1>{{ .Title }}</h1> +{{ .Content }} +{{- range .Sections }} + <h2>{{ .Title }}</h2> + <ul> + {{- range .Pages }} + <li> + <a href="{{ .Permalink }}">{{ .Title }}</a> + <small> + {{ .Date | dateFormat "2006-01-02" }} + {{- range .Params.tags }} + <a href="/tags/{{ . | lower }}">#{{ . }}</a> + {{- end }} + </small> + </li> + {{- end }} + </ul> +{{- end }} +{{- end }} diff --git a/layouts/posts/single.gmi b/layouts/posts/single.gmi new file mode 100644 index 0000000..cab9527 --- /dev/null +++ b/layouts/posts/single.gmi @@ -0,0 +1,33 @@ +{{ define "main" }} +<article> + <header> + <h1>{{ .Title }}</h1> + {{- range .Params.tags }} + <a href="/tags/{{ . | lower }}">#{{ . }}</a> + {{- end }} + {{- if .Draft }} + <section class="admonition"> + <div class="admonition-title"> + draft + </div> + <div class="admonition-content"> + This blog post is still a + <strong>draft</strong>. It has most likely been + shared with you for reviewing purposes. Please + do not yet share this with other people. + </div> + </section> + {{- end }} + </header> + <main> + {{ .Content }} + </main> + <footer> + <p class="text-center"> + <a class="image-link" rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/"> + <img alt="Creative Commons License" src="/img/cc-by-sa.png"> + </a> + </p> + </footer> +</article> +{{ end }} |