diff --git a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs index 1eccebea..fe5c8b3e 100644 --- a/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs +++ b/src/managed/OpenLiveWriter.BlogClient/Clients/StaticSite/StaticSiteClient.cs @@ -69,15 +69,8 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite /// If null, then includes future posts. If non-null, then only includes posts before the *UTC* 'now' time. /// public BlogPost[] GetRecentPosts(string blogId, int maxPosts, bool includeCategories, DateTime? now) => - Directory.GetFiles(Path.Combine(Config.LocalSitePath, Config.PostsPath), "*.html") - .Select(postFile => - { - try - { - return StaticSitePost.LoadFromFile(Path.Combine(Config.LocalSitePath, Config.PostsPath, postFile), Config).BlogPost; - } - catch { return null; } - }) + StaticSitePost.GetAllPosts(Config) + .Select(post => post.BlogPost) .Where(post => post != null && (now == null || post.DatePublished < now)) .OrderByDescending(post => post.DatePublished) .Take(maxPosts)