server, post: add about images for social media
Signed-off-by: Naman Sood <mail@nsood.in>
This commit is contained in:
parent
4fd8925116
commit
4c39700474
36 changed files with 216 additions and 3 deletions
7
post.go
7
post.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue