Timewarp Technologies Blog v2

Leveraging search engines to keep my notes

Apr 30, 2021 - 1 minute read

Scripting Creation of Posts

Next we script the creation of posts, which sit in a defined directory. This reduces the overhead to running the newpost.ps1 and when edits are complete running the previous up.ps1 command.

$postName = $args[0]
if($postName -eq "") {
    "Give the name of the post (no folder data required)."
} else {
    hugo new "content/posts/$($postName).md"
    code "content/posts/$($postName).md"
}