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

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