diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2023-01-22 12:45:03 +0100 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2023-01-22 12:45:03 +0100 |
commit | 5b5a0438682ecb69bbc8d7cb9904ad4b049033a3 (patch) | |
tree | bf5a689a3df4cbf9bd6188928d79d67517be63b3 /src/gmi/tpl | |
parent | 1cfdac5e8c2ac802275cb29ae9149c55547f38fb (diff) |
Implement gemini atom feed
Diffstat (limited to 'src/gmi/tpl')
-rw-r--r-- | src/gmi/tpl/feed.xml | 28 | ||||
-rw-r--r-- | src/gmi/tpl/posts/index.gmi | 2 |
2 files changed, 29 insertions, 1 deletions
diff --git a/src/gmi/tpl/feed.xml b/src/gmi/tpl/feed.xml new file mode 100644 index 0000000..497fb11 --- /dev/null +++ b/src/gmi/tpl/feed.xml @@ -0,0 +1,28 @@ +{{ $getPostsRes := .GetPosts 0 15 -}} +{{ $posts := $getPostsRes.Posts -}} + +<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom"> + <title>mediocregopher's lil web corner</title> + <id>{{ BlogURLAbs "/" }}</id> + {{ if gt (len $posts) 0 -}} + <updated>{{ (index $posts 0).PublishedAt.Format "2006-01-02T15:04:05Z07:00" }}</updated> + {{ end -}} + <link href="{{ BlogURLAbs "/" }}"></link> + <author> + <name>mediocregopher</name> + </author> + {{ range $posts -}} + <entry> + <title>{{ .Title }}</title> + <updated>{{ .PublishedAt.Format "2006-01-02T15:04:05Z07:00" }}</updated> + <id>{{ PostURLAbs .ID }}</id> + <link href="{{ PostURLAbs .ID }}" rel="alternate"></link> + {{ if .Description -}} + <summary type="html">{{ .Description }}</summary> + {{ end -}} + <author> + <name>mediocregopher</name> + </author> + </entry> + {{ end -}} +</feed> diff --git a/src/gmi/tpl/posts/index.gmi b/src/gmi/tpl/posts/index.gmi index dd4c84c..9d0f6e2 100644 --- a/src/gmi/tpl/posts/index.gmi +++ b/src/gmi/tpl/posts/index.gmi @@ -9,7 +9,7 @@ {{ end -}} {{ range $getPostsRes.Posts -}} -=> /posts/{{ .ID }}.gmi {{ .PublishedAt.Format "2006-01-02" }} - {{ .Title }} +=> {{ PostURL .ID }} {{ .PublishedAt.Format "2006-01-02" }} - {{ .Title }} {{ end -}} |