Skip to content

Instantly share code, notes, and snippets.

@lonelydev
Last active December 25, 2022 16:22
Show Gist options
  • Save lonelydev/736cc33b18a4892980a0f8072236f276 to your computer and use it in GitHub Desktop.
Save lonelydev/736cc33b18a4892980a0f8072236f276 to your computer and use it in GitHub Desktop.
A little wrapper function to create a new hugo post with the title and timestamped
function hnp() {
post_name=$1
if [[ -z $post_name ]] || [[ ${#post_name} -lt 5 ]]; then
echo "ERROR: Please provide a name for your post! Names must be at least 5 characters long."
echo "Usage: hnp this-is-my-post"
return 1
fi
hugo new "post/"`date +"%Y-%m-%d"`"-$post_name.md"
}
export hnp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment