flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit c1ba1a1d082df5c03376ebb44d07234e0b8b1cc6
parent 9ca9f79a9bb4c14f1d4a3bdd7f136f7dc86b1d4d
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sun, 27 Dec 2020 14:40:18 -0800

Add new gemlog post link

Diffstat:
Mhttp.go | 12+++++++-----
Mtemplates/my_site.html | 3+++
2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/http.go b/http.go @@ -252,12 +252,14 @@ func mySiteHandler(w http.ResponseWriter, r *http.Request) { // check auth userFolder := getUserDirectory(user.Username) files, _ := getMyFilesRecursive(userFolder, user.Username) + currentDate := time.Now().Format("2006-01-02") data := struct { - Host string - PageTitle string - Files []*File - AuthUser AuthUser - }{c.Host, c.SiteTitle, files, user} + Host string + PageTitle string + Files []*File + AuthUser AuthUser + CurrentDate string + }{c.Host, c.SiteTitle, files, user, currentDate} _ = t.ExecuteTemplate(w, "my_site.html", data) } diff --git a/templates/my_site.html b/templates/my_site.html @@ -69,6 +69,9 @@ } </script> <br /> +<a href="/edit/gemlog/{{.CurrentDate}}.gmi">New Gemlog Post</a> +<br /> +<br /> <form action="/upload" enctype="multipart/form-data" method="POST"> <input type="file" id="myFile" name="file" multiple /> <input type="submit" value="Upload file" class="button" />