server, post: add about images for social media

Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
Naman Sood 2021-12-17 03:09:04 -05:00
parent 4fd8925116
commit 4c39700474
36 changed files with 216 additions and 3 deletions

View file

@ -31,6 +31,7 @@ type Post struct {
Slug string
Metadata Metadata
Contents string
Image bytes.Buffer
}
func newPost(slug string) (*Post, error) {
@ -73,6 +74,12 @@ func newPost(slug string) (*Post, error) {
Contents: converted.String(),
}
url := blogURL + "/" + slug
err = createImage(post.Metadata.Title, post.Metadata.Summary, url, &post.Image)
if err != nil {
return nil, fmt.Errorf("could not create post image: %v", err)
}
return post, nil
}