public bool EditPage(string blogId, BlogPost page, bool publish, out string etag, out XmlDocument remotePost) { if (!publish) { Trace.Fail("Posting pages as drafts not yet implemented."); throw new BlogClientPostAsDraftUnsupportedException(); } //if (!publish && !Options.SupportsPostAsDraft) //{ // Trace.Fail("Static site does not support drafts, cannot post."); // throw new BlogClientPostAsDraftUnsupportedException(); //} remotePost = null; etag = ""; // Create a StaticSitePage on the provided page var ssgPage = new StaticSitePage(Config, page); if (ssgPage.FilePathById == null) { // Existing page could not be found to edit, call NewPage instead; NewPage(blogId, page, publish, out etag, out remotePost); return(true); } // Set slug to existing slug on page ssgPage.Slug = page.Slug; return(DoEditItem(ssgPage)); }
public BlogPost GetPage(string blogId, string pageId) { var page = StaticSitePage.GetPageById(Config, pageId); page.ResolveParent(); return(page.BlogPost); }
public void DeletePage(string blogId, string pageId) { var page = StaticSitePage.GetPageById(Config, pageId); if (page == null) { throw new BlogClientException( Res.Get(StringId.SSGErrorPageDoesNotExistTitle), Res.Get(StringId.SSGErrorPageDoesNotExistText)); } DoDeleteItem(page); }
public BlogPost[] GetPages(string blogId, int maxPages) => StaticSitePage.GetAllPages(Config) .Select(page => page.BlogPost) .OrderByDescending(page => page.DatePublished) .Take(maxPages) .ToArray();
public PageInfo[] GetPageList(string blogId) => StaticSitePage.GetAllPages(Config).Select(page => page.PageInfo).ToArray();