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
|
// Set Date if not provided
|
||||||
if (post.DatePublished == new DateTime(1, 1, 1)) post.DatePublished = DateTime.Now;
|
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);
|
var ssgPost = new StaticSitePost(Config, post);
|
||||||
|
// Ensure the post has an ID
|
||||||
|
var newPostId = ssgPost.EnsureId();
|
||||||
|
// Save the post to disk
|
||||||
ssgPost.SaveToDisk();
|
ssgPost.SaveToDisk();
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -95,7 +98,7 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
// Publish the site
|
// Publish the site
|
||||||
DoSitePublish();
|
DoSitePublish();
|
||||||
|
|
||||||
return "";
|
return newPostId;
|
||||||
} catch (Exception ex)
|
} catch (Exception ex)
|
||||||
{
|
{
|
||||||
// Clean up our output file
|
// Clean up our output file
|
||||||
|
|
|
@ -181,9 +181,6 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SaveToDisk()
|
public void SaveToDisk()
|
||||||
{
|
{
|
||||||
// Generate an ID if one isn't already generated
|
|
||||||
EnsureId();
|
|
||||||
|
|
||||||
// Generate a safe slug if one isn't already generated
|
// Generate a safe slug if one isn't already generated
|
||||||
// This ensures we don't overwrite an existing post
|
// This ensures we don't overwrite an existing post
|
||||||
EnsureSafeSlug();
|
EnsureSafeSlug();
|
||||||
|
|
Loading…
Reference in New Issue