diff options
Diffstat (limited to 'src/gmi/tpl')
-rw-r--r-- | src/gmi/tpl/index.gmi | 3 | ||||
-rw-r--r-- | src/gmi/tpl/posts/index.gmi | 18 | ||||
-rw-r--r-- | src/gmi/tpl/posts/post.gmi | 9 |
3 files changed, 30 insertions, 0 deletions
diff --git a/src/gmi/tpl/index.gmi b/src/gmi/tpl/index.gmi new file mode 100644 index 0000000..7c68b92 --- /dev/null +++ b/src/gmi/tpl/index.gmi @@ -0,0 +1,3 @@ +# Index + +=> /posts/index.gmi See all posts diff --git a/src/gmi/tpl/posts/index.gmi b/src/gmi/tpl/posts/index.gmi new file mode 100644 index 0000000..12eb39c --- /dev/null +++ b/src/gmi/tpl/posts/index.gmi @@ -0,0 +1,18 @@ +# mediocregopher's Posts + +{{ $page := .GetQueryIntValue "page" 0 -}} +{{ $getPostsRes := .GetPosts $page 20 -}} + +{{ if gt $page 0 -}} +=> /posts.gmi?page={{ .Add $page -1 }} Previous Page + +{{ end -}} + +{{ range $getPostsRes.Posts -}} +=> /posts/{{ .ID }}.gmi {{ .PublishedAt.Format "2006-01-02" }} - {{ .Title }} + +{{ end -}} + +{{ if $getPostsRes.HasMore -}} +=> /posts.gmi?page={{ .Add $page 1 }} Next page +{{ end -}} diff --git a/src/gmi/tpl/posts/post.gmi b/src/gmi/tpl/posts/post.gmi new file mode 100644 index 0000000..52ac5ff --- /dev/null +++ b/src/gmi/tpl/posts/post.gmi @@ -0,0 +1,9 @@ +{{ $post := .GetPostByID (.GetQueryValue "id" "") -}} + +# {{ $post.Title }} + +{{ if ne $post.Description "" -}} +> {{ $post.Description }} +{{ end -}} + +{{ $post.Body }} |