Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        public BlogPost GetPage(string blogId, string pageId)
        {
            var page = StaticSitePage.GetPageById(Config, pageId);

            page.ResolveParent();
            return(page.BlogPost);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 public BlogPost[] GetPages(string blogId, int maxPages) =>
 StaticSitePage.GetAllPages(Config)
 .Select(page => page.BlogPost)
 .OrderByDescending(page => page.DatePublished)
 .Take(maxPages)
 .ToArray();
Esempio n. 5
0
 public PageInfo[] GetPageList(string blogId) =>
 StaticSitePage.GetAllPages(Config).Select(page => page.PageInfo).ToArray();