Skip to main content
ertius.org

hugo aliases

After switching to using Hugo archetypes for new posts, I wanted some quick aliases to make new til posts. For today is easy:

alias new_til="cd ~/src/til && hugo new til/posts/$(date +%F).md"

But for tomorrow is harder - MacOS (BSD) date doesn't support -d and GNU date doesn't support -v, and they have a different syntax for adding days anyway. So, I ended up with this for MacOS:

alias tom_til="cd ~/src/til && hugo new til/posts/$(date -v +1d +%F).md"

and this for GNU:

alias tom_til="cd ~/src/til && hugo new til/posts/$(date -d "+1day" +%F).md"

Each is in the appropriate platform-specific shell config file.