1package gnoblog
2
3import (
4 "std"
5
6 "gno.land/p/demo/blog"
7)
8
9var b = &blog.Blog{
10 Title: "gno.land's blog",
11 Prefix: "/r/gnoland/blog:",
12}
13
14func AddComment(postSlug, comment string) {
15 assertIsCommenter()
16 assertNotInPause()
17
18 caller := std.GetOrigCaller()
19 err := b.GetPost(postSlug).AddComment(caller, comment)
20 checkErr(err)
21}
22
23func Render(path string) string {
24 return b.Render(path)
25}
26
27func RenderLastPostsWidget(limit int) string {
28 return b.RenderLastPostsWidget(limit)
29}
30
31func PostExists(slug string) bool {
32 if b.GetPost(slug) == nil {
33 return false
34 }
35 return true
36}
gnoblog.gno
0.57 Kb ยท 36 lines