diff --git a/post.go b/post.go index 2e7b285..13e920c 100644 --- a/post.go +++ b/post.go @@ -111,14 +111,15 @@ func newPostList() (postList, error) { } func insertOrUpdatePost(pl postList, p *Post) postList { - defer sort.Sort(pl) for i, post := range pl { if post.Slug == p.Slug { pl[i] = p + sort.Sort(pl) return pl } } pl = append(pl, p) + sort.Sort(pl) return pl }