blog: display bluesky like and repost counts
This commit is contained in:
parent
486c9ae641
commit
fece0f5da6
1 changed files with 11 additions and 11 deletions
22
view/blog.go
22
view/blog.go
|
@ -16,6 +16,15 @@ import (
|
||||||
"github.com/gomarkdown/markdown/parser"
|
"github.com/gomarkdown/markdown/parser"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type BlogView struct {
|
||||||
|
*model.Blog
|
||||||
|
Comments []*model.ThreadViewPost
|
||||||
|
Likes int
|
||||||
|
Reposts int
|
||||||
|
BlueskyURL string
|
||||||
|
MastodonURL string
|
||||||
|
}
|
||||||
|
|
||||||
var mdRenderer = html.NewRenderer(html.RendererOptions{
|
var mdRenderer = html.NewRenderer(html.RendererOptions{
|
||||||
Flags: html.CommonFlags | html.HrefTargetBlank,
|
Flags: html.CommonFlags | html.HrefTargetBlank,
|
||||||
})
|
})
|
||||||
|
@ -109,20 +118,11 @@ this is `+"`"+`aridoodle`+"`"+`. please take care of her.
|
||||||
comments = append(comments, blueskyPost.Replies...)
|
comments = append(comments, blueskyPost.Replies...)
|
||||||
}
|
}
|
||||||
|
|
||||||
type BlogView struct {
|
|
||||||
*model.Blog
|
|
||||||
Comments []*model.ThreadViewPost
|
|
||||||
Likes int
|
|
||||||
Reposts int
|
|
||||||
BlueskyURL string
|
|
||||||
MastodonURL string
|
|
||||||
}
|
|
||||||
|
|
||||||
err = templates.BlogTemplate.Execute(w, BlogView{
|
err = templates.BlogTemplate.Execute(w, BlogView{
|
||||||
Blog: &blog,
|
Blog: &blog,
|
||||||
Comments: blueskyPost.Replies,
|
Comments: blueskyPost.Replies,
|
||||||
Likes: 10,
|
Likes: blueskyPost.Post.LikeCount,
|
||||||
Reposts: 10,
|
Reposts: blueskyPost.Post.RepostCount,
|
||||||
BlueskyURL: fmt.Sprintf("https://bsky.app/profile/%s/post/%s", blog.BlueskyActorID, blog.BlueskyPostID),
|
BlueskyURL: fmt.Sprintf("https://bsky.app/profile/%s/post/%s", blog.BlueskyActorID, blog.BlueskyPostID),
|
||||||
MastodonURL: "#",
|
MastodonURL: "#",
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue