diff --git a/examples/gno.land/p/demo/blog/blog.gno b/examples/gno.land/p/demo/blog/blog.gno index 6be11336b0c..2c9c0e89359 100644 --- a/examples/gno.land/p/demo/blog/blog.gno +++ b/examples/gno.land/p/demo/blog/blog.gno @@ -21,9 +21,13 @@ type Blog struct { } func (b Blog) RenderLastPostsWidget(limit int) string { + if b.PostsPublished.Size() == 0 { + return "No posts." + } + output := "" i := 0 - b.Posts.Iterate("", "", func(key string, value interface{}) bool { + b.PostsPublished.ReverseIterate("", "", func(key string, value interface{}) bool { p := value.(*Post) output += ufmt.Sprintf("- [%s](%s)\n", p.Title, p.URL()) i++ diff --git a/examples/gno.land/r/gnoland/home/home.gno b/examples/gno.land/r/gnoland/home/home.gno index b09c272f01c..737c811c062 100644 --- a/examples/gno.land/r/gnoland/home/home.gno +++ b/examples/gno.land/r/gnoland/home/home.gno @@ -57,7 +57,7 @@ func Render(_ string) string { func lastBlogposts(limit int) ui.Element { posts := blog.RenderLastPostsWidget(limit) return ui.Element{ - ui.H3("Last Blogposts"), + ui.H3("Latest Blogposts"), ui.Text(posts), } } diff --git a/examples/gno.land/r/gnoland/home/home_filetest.gno b/examples/gno.land/r/gnoland/home/home_filetest.gno index 2bd1b2fd6c1..0304ad641f6 100644 --- a/examples/gno.land/r/gnoland/home/home_filetest.gno +++ b/examples/gno.land/r/gnoland/home/home_filetest.gno @@ -64,9 +64,9 @@ func main() { //