Something went wrong. Try again.
karitham.dev website! atproto & fancy ssg + csr & blog articles karitham.dev
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829//// Pure post template. The date is injected so the scaffolder is//// testable with a fixed "today".
import cli/slugimport dateimport gleam/int
/// Render the post template for a given slug. `today` is the current/// date as `#(year, month, day)` so the scaffolded post sorts to the/// top of the timeline; the shell (`cli.gleam`) reads the clock.pub fn template(slug: String, today: #(Int, Int, Int)) -> String { let #(y, m, d) = today let date = int.to_string(y) <> "-" <> date.pad2(m) <> "-" <> date.pad2(d) "---\n" <> "title: " <> slug.title_from_slug(slug) <> "\n" <> "description: \n" <> "date: " <> date <> "\n" <> "tags: []\n" <> "draft: true\n" <> "image: \n" <> "---\n" <> "\n" <> "Write your post here.\n"}