From: early Date: Mon, 2 Sep 2024 18:44:57 +0000 (-0600) Subject: add more tools for static support X-Git-Url: https://git.earlybird.gay/?a=commitdiff_plain;h=9288faf23a78cb48bfab22c02447bce5753fa104;p=today add more tools for static support --- diff --git a/cmd/standard-test/index.html b/cmd/standard-test/index.html deleted file mode 100644 index bb6af6c..0000000 --- a/cmd/standard-test/index.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - Today Engine Examples - - - - -
- - - - {{- range $i, $v := SliceOfLen 5 }} - - {{ end -}} -
- - - \ No newline at end of file diff --git a/cmd/standard-test/main.go b/cmd/standard-test/main.go index 43a1495..88fad7c 100644 --- a/cmd/standard-test/main.go +++ b/cmd/standard-test/main.go @@ -20,7 +20,7 @@ var Thing = part.New("test-thing", "test_thing.html", }), ) -var Page = page.New("index", "index.html", +var Page = page.New("index", "pages/index.html", page.Includes( stdpart.ContactForm([]string{"Feedback"}), Thing, ), @@ -33,15 +33,17 @@ var Page = page.New("index", "index.html", return out }, }), - page.Pretty(" "), ) +var Static = page.Static("pages/static.html") + func main() { app := tapp.New() tapp.GetEnv().Apply(app) app.ShutdownOnSignal(syscall.SIGINT, syscall.SIGTERM) app.Handle("GET /{$}", Page) + app.Handle("GET /static", Static) app.Handle("GET /", http.FileServer(http.Dir("public"))) app.Handle("GET /contact", stdpart.HandleContactForm(nil, stdpart.PrintContact)) app.Handle("POST /contact", stdpart.HandleContactForm(nil, stdpart.PrintContact)) diff --git a/cmd/standard-test/pages/index.html b/cmd/standard-test/pages/index.html new file mode 100644 index 0000000..b7a2f80 --- /dev/null +++ b/cmd/standard-test/pages/index.html @@ -0,0 +1,22 @@ + + + + + Today Engine Examples + + + + +
+ + + + {{- range $i, $v := SliceOfLen 5 }} + + {{ end -}} + + Link to static page +
+ + + \ No newline at end of file diff --git a/cmd/standard-test/pages/static.html b/cmd/standard-test/pages/static.html new file mode 100644 index 0000000..e03b202 --- /dev/null +++ b/cmd/standard-test/pages/static.html @@ -0,0 +1,16 @@ + + + + + Today Engine Examples + + + + +
+

This is a normal static page.

+

It doesn't do anything except exist. Neat.

+
+ + + \ No newline at end of file