ssg: StaticSitePost: ensure Id and safe slug when saving to disk
This commit is contained in:
parent
e614030d46
commit
689fee79e5
|
@ -178,6 +178,17 @@ namespace OpenLiveWriter.BlogClient.Clients.StaticSite
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Save the post to the correct directory
|
/// Save the post to the correct directory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SaveToDisk() => File.WriteAllText(FilePath, ToString());
|
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();
|
||||||
|
|
||||||
|
// Save the post to disk
|
||||||
|
File.WriteAllText(FilePath, ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue