ssg: StaticSiteClient, StaticSitePost: move EnsureId call to StaticSiteClient from StaticSitePost SaveToDisk, return postId from NewPost
This commit is contained in:
parent
9cd3fbf953
commit
4ad1e89349
|
@ -83,8 +83,11 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
|||
// Set Date if not provided
|
||||
if (post.DatePublished == new DateTime(1, 1, 1)) post.DatePublished = DateTime.Now;
|
||||
|
||||
// Write to file
|
||||
// Create a StaticSitePost on the provided post
|
||||
var ssgPost = new StaticSitePost(Config, post);
|
||||
// Ensure the post has an ID
|
||||
var newPostId = ssgPost.EnsureId();
|
||||
// Save the post to disk
|
||||
ssgPost.SaveToDisk();
|
||||
|
||||
try
|
||||
|
@ -95,7 +98,7 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
|||
// Publish the site
|
||||
DoSitePublish();
|
||||
|
||||
return "";
|
||||
return newPostId;
|
||||
} catch (Exception ex)
|
||||
{
|
||||
// Clean up our output file
|
||||
|
|
|
@ -181,9 +181,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
|||
/// </summary>
|
||||
public void SaveToDisk()
|
||||
{
|
||||
// Generate an ID if one isn't already generated
|
||||
EnsureId();
|
||||
|
||||
// Generate a safe slug if one isn't already generated
|
||||
// This ensures we don't overwrite an existing post
|
||||
EnsureSafeSlug();
|
||||
|
|
Loading…
Reference in New Issue