Beispiel #1
0
        /// <summary>
        /// Get the version of the post currently residing on the server
        /// </summary>
        /// <param name="blogPost"></param>
        /// <returns></returns>
        public async Task <BlogPost> GetPost(string postId, bool isPage)
        {
            BlogPost blogPost = null;

            if (isPage)
            {
                // get the page
                blogPost = await BlogClient.GetPage(_settings.HostBlogId, postId);

                // ensure it is marked as a page
                blogPost.IsPage = true;
            }
            else
            {
                blogPost = await BlogClient.GetPost(_settings.HostBlogId, postId);

                // if there is no permalink then attempt to construct one
                EnsurePermalink(blogPost);
            }

            // apply content filters
            blogPost.Contents = ContentFilterApplier.ApplyContentFilters(ClientOptions.ContentFilter, blogPost.Contents, ContentFilterMode.Open);

            // return the blog post
            return(blogPost);
        }
Beispiel #2
0
        public BlogPost[] GetRecentPosts(int maxPosts, bool includeCategories)
        {
            BlogPost[] recentPosts = BlogClient.GetRecentPosts(_settings.HostBlogId, maxPosts, includeCategories, null);
            foreach (BlogPost blogPost in recentPosts)
            {
                // apply content filters
                blogPost.Contents = ContentFilterApplier.ApplyContentFilters(ClientOptions.ContentFilter, blogPost.Contents, ContentFilterMode.Open);

                // if there is no permalink then attempt to construct one
                EnsurePermalink(blogPost);
            }

            return(recentPosts);
        }