ssg: StaticSiteClient: EditPage impl

This commit is contained in:
Nick Vella 2019-07-21 01:31:35 +10:00
parent 8f098815d5
commit cbaaa0f811
1 changed files with 21 additions and 2 deletions

View File

@ -191,9 +191,28 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
public bool EditPage(string blogId, BlogPost page, bool publish, out string etag, out XmlDocument remotePost)
{
if (!publish && !Options.SupportsPostAsDraft)
{
Trace.Fail("Static site does not support drafts, cannot post.");
throw new BlogClientPostAsDraftUnsupportedException();
}
remotePost = null;
etag = "";
remotePost = new XmlDocument();
return false;
// 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 void DeletePage(string blogId, string pageId)