diff options
| author | Samuel Johnson <[email protected]> | 2025-11-24 01:36:18 -0500 |
|---|---|---|
| committer | Samuel Johnson <[email protected]> | 2025-11-24 01:36:18 -0500 |
| commit | 384a590b5462883d714bc1682e4d81d6321b2b12 (patch) | |
| tree | 01d3ed55448948a2fe162b7209f0f2211770c9fb /cmd | |
| parent | 177663c73f3d708120b975a74eebd0951177a53b (diff) | |
Improve page layout, add navbar
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/parser/main.go | 2 | ||||
| -rw-r--r-- | cmd/web/handlers/blog.go | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/cmd/parser/main.go b/cmd/parser/main.go index bf79439..6d3c3c4 100644 --- a/cmd/parser/main.go +++ b/cmd/parser/main.go @@ -123,7 +123,7 @@ func main() { _, table_check := db.Query("SELECT * FROM posts;") if table_check != nil { - _, err = db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, time DATE DEFAULT CURRENT_DATE, content TEXT NOT NULL);") + _, err = db.Exec("CREATE TABLE posts (id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, content TEXT NOT NULL);") if err != nil { fmt.Fprintf(os.Stderr, "Unable to create posts table: %v\n", err) os.Exit(1) diff --git a/cmd/web/handlers/blog.go b/cmd/web/handlers/blog.go index 07ab361..bd2d97f 100644 --- a/cmd/web/handlers/blog.go +++ b/cmd/web/handlers/blog.go @@ -18,6 +18,8 @@ type blogContext struct { } func (ctx *blogContext) index(w http.ResponseWriter, r *http.Request) { + ctx.Rows = []models.Post{} + if r.URL.Path != "/" { http.NotFound(w, r) return |
