feat: Add support for gemini

Closes #1
Closes #2
pull/3/head
earnest ma 2021-02-09 17:09:17 -05:00
parent 17bd0b7b87
commit 55db714561
No known key found for this signature in database
GPG Key ID: 6B361FA81C5FB695
5 changed files with 83 additions and 19 deletions

View File

@ -17,21 +17,20 @@
<ul> <ul>
{{ range .Pages }} {{ range .Pages }}
<li> <li><i>
<span> <time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
<i> {{ .Date.Format "Jan 02, 2006" }}
<time datetime='{{ .Date.Format "2006-01-02" }}' pubdate> </time></i>
{{ .Date.Format "Jan 02, 2006" }} {{- if .OutputFormats.Get "html" }}
</time>
</i>
</span>
<a href="{{ .Permalink }}">{{ .Title }}</a> <a href="{{ .Permalink }}">{{ .Title }}</a>
</li> </li>
{{ else }} {{- else if .OutputFormats.Get "gemtext" }}
<li> {{ with .OutputFormats.Get "gemtext" }}
<p>No posts yet, check back soon.</p> <a href="{{ replace .Permalink "/gemini" "" 1 | safeURL }}">{{ end }}{{ .Title }}</a>
<small>(<a href="https://www.earnestma.xyz/gemini" target="_blank">what is gemini://?</a>)</small>
</li> </li>
{{ end }} {{ end }}
{{ end }}
</ul> </ul>
{{ if .Data.Singular }} {{ if .Data.Singular }}

View File

@ -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 }}

30
layouts/blog/single.gmi Normal file
View File

@ -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 }}

View File

@ -1,21 +1,23 @@
{{ define "main" }} {{ define "main" }}
<h1>{{ .Title }}</h1> <h1>{{ .Title }}</h1>
<p> <ul>
&#8226; Published on <li>
<time datetime='{{ .Date.Format "2006-01-02" }}' pubdate> Published on {{ .Date.Format "Jan 02, 2006" }}
{{ .Date.Format "Jan 02, 2006" }}
</time> </time>
{{ if .Lastmod }}{{ if not (eq .Lastmod .Date )}} {{ if .Lastmod }}{{ if not (eq .Lastmod .Date )}}
<i> <i>(<b>updated</b> {{ dateFormat "2006-01-02" .Lastmod.Local }})</i>
(<b>updated</b> {{ dateFormat "2006-01-02" .Lastmod.Local }})
</i>
{{ end }}{{ end }} {{ end }}{{ end }}
{{ with .Page.Params.Authors }} {{ with .Page.Params.Authors }}
{{ partial "taxonomy-authors.html" . -}} {{ partial "taxonomy-authors.html" . -}}
{{ end }} {{ end }}
</p> </li>
{{ with .OutputFormats.Get "gemtext" }}
<li>Read via <a href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini</a></li>
{{- end }}
</ul>
<content> <content>
{{ .Content }} {{ .Content }}

14
layouts/index.gmi Normal file
View File

@ -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 }}