diff options
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/blogspace/seed.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/blogspace/seed.go b/cmd/blogspace/seed.go index f69a774..05c54f8 100644 --- a/cmd/blogspace/seed.go +++ b/cmd/blogspace/seed.go @@ -77,7 +77,12 @@ func seed(ctx context.Context, cfg *config.Config, st *store.Store) error { if err := png.Encode(&buf, img); err != nil { return err } - bg, err := bs.CreateImage(ctx, "gradient.png", "image/png", buf.Bytes()) + bg, err := bs.CreateFile(ctx, "gradient.png", "image/png", "image", buf.Bytes()) + if err != nil { + return err + } + // and a plain text file, so the Files tab shows more than images + notes, err := bs.CreateFile(ctx, "notes.txt", "text/plain", "document", []byte("Reading list:\n- The Go Programming Language\n- Practical Vim\n")) if err != nil { return err } @@ -107,7 +112,7 @@ func seed(ctx context.Context, cfg *config.Config, st *store.Store) error { } } posts := []struct{ page, title, body string }{ - {"home", "Welcome to my corner of the web", "This is the **first post**. It lives on the home page.\n\nThings I plan to write about:\n\n- tomatoes\n- Go\n- the occasional recipe\n\n + ")\n\nThat image above was uploaded through the dashboard."}, + {"home", "Welcome to my corner of the web", "This is the **first post**. It lives on the home page.\n\nThings I plan to write about:\n\n- tomatoes\n- Go\n- the occasional recipe\n\n + ")\n\nThat image above was uploaded through the dashboard, and here is a file to download: [notes.txt](/media/" + notes.ID.String() + ")."}, {"home", "Why I still like plain HTML", "No frameworks, no build step. Just `<p>` tags and a stylesheet.\n\n> Simplicity is prerequisite for reliability. — Dijkstra\n\n```go\nfunc main() {\n\tfmt.Println(\"hello\")\n}\n```"}, {"news", "Site is up", "The blog is live. Expect sporadic updates."}, {"news", "Tomato season", "First ripe tomato of the year! Table for the record:\n\n| Variety | Days |\n|---|---|\n| Cherry | 62 |\n| Beefsteak | 85 |"}, |
