]> git.earlybird.gay Git - today/commitdiff
add more tools for static support
authorearly <me@earlybird.gay>
Mon, 2 Sep 2024 18:44:57 +0000 (12:44 -0600)
committerearly <me@earlybird.gay>
Mon, 2 Sep 2024 18:44:57 +0000 (12:44 -0600)
cmd/standard-test/index.html [deleted file]
cmd/standard-test/main.go
cmd/standard-test/pages/index.html [new file with mode: 0644]
cmd/standard-test/pages/static.html [new file with mode: 0644]

diff --git a/cmd/standard-test/index.html b/cmd/standard-test/index.html
deleted file mode 100644 (file)
index bb6af6c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<html>
-
-<head>
-    <title>Today Engine Examples</title>
-    <link rel="stylesheet" href="/style.css">
-</head>
-
-<body>
-    <main>
-        <stdp-contact-form :action="/contact" id="cf-get"></stdp-contact-form>
-        <stdp-contact-form :action="/contact" :method="POST" id="cf-post"></stdp-contact-form>
-
-        {{- range $i, $v := SliceOfLen 5 }}
-        <test-thing :value="."></test-thing>
-        {{ end -}}
-    </main>
-</body>
-
-</html>
\ No newline at end of file
index 43a1495a81e9a65583a8f3f97667b719b6fe4c76..88fad7c8c4ac66a690bd4f339bee5708933cbbb6 100644 (file)
@@ -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 (file)
index 0000000..b7a2f80
--- /dev/null
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>Today Engine Examples</title>
+    <link rel="stylesheet" href="/style.css">
+</head>
+
+<body>
+    <main>
+        <stdp-contact-form :action="/contact" id="cf-get"></stdp-contact-form>
+        <stdp-contact-form :action="/contact" :method="POST" id="cf-post"></stdp-contact-form>
+
+        {{- range $i, $v := SliceOfLen 5 }}
+        <test-thing :value="."></test-thing>
+        {{ end -}}
+
+        <a href="/static">Link to static page</a>
+    </main>
+</body>
+
+</html>
\ 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 (file)
index 0000000..e03b202
--- /dev/null
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <title>Today Engine Examples</title>
+    <link rel="stylesheet" href="/style.css">
+</head>
+
+<body>
+    <main>
+      <h1>This is a normal static page.</h1>
+      <p>It doesn't do anything except exist. Neat.</p>
+    </main>
+</body>
+
+</html>
\ No newline at end of file