From 1242be7cfec1faa6a880d625307e32a1a91937ac Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 20 May 2022 08:36:52 -0600 Subject: Implement posts index page --- srv/src/api/tpl/assets.html | 2 +- srv/src/api/tpl/index.html | 2 +- srv/src/api/tpl/post.html | 8 +++--- srv/src/api/tpl/posts.html | 61 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 srv/src/api/tpl/posts.html (limited to 'srv/src/api/tpl') diff --git a/srv/src/api/tpl/assets.html b/srv/src/api/tpl/assets.html index b8d51a2..aa5e422 100644 --- a/srv/src/api/tpl/assets.html +++ b/srv/src/api/tpl/assets.html @@ -33,7 +33,7 @@ {{ . }}
diff --git a/srv/src/api/tpl/index.html b/srv/src/api/tpl/index.html index b634169..946a3e4 100644 --- a/srv/src/api/tpl/index.html +++ b/srv/src/api/tpl/index.html @@ -5,7 +5,7 @@ {{ range .Payload.Posts }}
  • - {{ .Title }} + {{ .Title }}

    {{ .PublishedAt.Format "2006-01-02" }} {{ if not .LastUpdatedAt.IsZero }} diff --git a/srv/src/api/tpl/post.html b/srv/src/api/tpl/post.html index c5c3c96..fadab3c 100644 --- a/srv/src/api/tpl/post.html +++ b/srv/src/api/tpl/post.html @@ -19,10 +19,10 @@

    This post is part of a series:
    {{ if .Payload.SeriesPrevious }} - Previously: {{ .Payload.SeriesPrevious.Title }}
    + Previously: {{ .Payload.SeriesPrevious.Title }}
    {{ end }} {{ if .Payload.SeriesNext }} - Next: {{ .Payload.SeriesNext.Title }}
    + Next: {{ .Payload.SeriesNext.Title }}
    {{ end }}

    {{ end }} @@ -35,10 +35,10 @@

    If you liked this post, consider checking out other posts in the series:
    {{ if .Payload.SeriesPrevious }} - Previously: {{ .Payload.SeriesPrevious.Title }}
    + Previously: {{ .Payload.SeriesPrevious.Title }}
    {{ end }} {{ if .Payload.SeriesNext }} - Next: {{ .Payload.SeriesNext.Title }}
    + Next: {{ .Payload.SeriesNext.Title }}
    {{ end }}

    {{ end }} diff --git a/srv/src/api/tpl/posts.html b/srv/src/api/tpl/posts.html new file mode 100644 index 0000000..e701f59 --- /dev/null +++ b/srv/src/api/tpl/posts.html @@ -0,0 +1,61 @@ +{{ define "posts-nextprev" }} + + {{ if or (ge .Payload.PrevPage 0) (ge .Payload.NextPage 0) }} +
    + + {{ if ge .Payload.PrevPage 0 }} + Newer + {{ end }} + + {{ if ge .Payload.NextPage 0 }} + Older + {{ end }} + +
    + {{ end }} + +{{ end }} + +{{ define "body" }} + + {{ $csrfFormInput := .CSRFFormInput }} + + +

    + + + +

    + + {{ template "posts-nextprev" . }} + + + + {{ range .Payload.Posts }} + + + + + + + {{ end }} + +
    {{ .PublishedAt }}{{ .Title }} + + + + + + {{ $csrfFormInput }} + + +
    + + {{ template "posts-nextprev" . }} + +{{ end }} + +{{ template "base.html" . }} -- cgit v1.2.3