feat: Add support for gemini #2

Closed
earnestma wants to merge 1 commits from refs/pull/2/head into develop
5 changed files with 83 additions and 19 deletions

View File

@ -17,21 +17,20 @@
<ul>
{{ range .Pages }}
<li>
<span>
<i>
<time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
{{ .Date.Format "Jan 02, 2006" }}
</time>
</i>
</span>
<li><i>
<time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
{{ .Date.Format "Jan 02, 2006" }}
</time></i>
{{- if .OutputFormats.Get "html" }}
<a href="{{ .Permalink }}">{{ .Title }}</a>
</li>
{{ else }}
<li>
<p>No posts yet, check back soon.</p>
{{- else if .OutputFormats.Get "gemtext" }}
{{ with .OutputFormats.Get "gemtext" }}
<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>
{{ end }}
{{ end }}
</ul>
{{ 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" }}
<h1>{{ .Title }}</h1>
<p>
&#8226; Published on
<time datetime='{{ .Date.Format "2006-01-02" }}' pubdate>
{{ .Date.Format "Jan 02, 2006" }}
<ul>
<li>
Published on {{ .Date.Format "Jan 02, 2006" }}
</time>
{{ if .Lastmod }}{{ if not (eq .Lastmod .Date )}}
<i>
(<b>updated</b> {{ dateFormat "2006-01-02" .Lastmod.Local }})
</i>
<i>(<b>updated</b> {{ dateFormat "2006-01-02" .Lastmod.Local }})</i>
{{ end }}{{ end }}
{{ with .Page.Params.Authors }}
{{ partial "taxonomy-authors.html" . -}}
{{ end }}
</p>
</li>
{{ with .OutputFormats.Get "gemtext" }}
<li>Read via <a href="{{replace .Permalink "/gemini" "" 1 | safeURL}}">Gemini</a></li>
{{- end }}
</ul>
<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 }}