package app import ( "fmt" "slices" "strings" "git.akyoto.dev/go/markdown" "git.akyoto.dev/go/web" ) func RenderPost(ctx web.Context, id string) error { post := Posts[id] head := fmt.Sprintf(`%s`, post.Title, strings.Join(post.Tags, ",")) content := "" if slices.Contains(post.Tags, "article") { content = fmt.Sprintf( `

%s

%s
`, post.Title, post.Created, post.Created[:len("YYYY-MM-DD")], markdown.Render(post.Content), ) } else { content = fmt.Sprintf( `

%s

%s`, post.Title, markdown.Render(post.Content), ) } return Render(ctx, head, content) }