示例#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);
        }