Hugo has worked out well for creating this blog. To make it even easier, I wanted to make creation of new posts simpler. To date, I’ve basically looked at the last post and then created the next one in sequence by using the command hugo new ~/myblog/post/content/091.md
, for example.
To automate that some, I created a bash alias that looks like:
alias newpost='hugo new ~/myblog/content/post/$(printf "%03d.md" $(expr $(basename $(ls ~/myblog/content/post/ | tail -n 1) .md) + 1))'
This works by listing the directory for the post folder, getting the last one, extracting the basename of the file, adding one to it and then converting it a three digit number.
Now, all I have to do is type newpost
and Hugo creates a post with the next sequential number in the proper folder. I might add a bit to open it up in Vim automatically, but that’s getting quite complicated for an alias so I’ll see how this goes.
I also noticed that Hugo updates the copyright at the bottom of the page automatically for year of the most current post. That’s a nice feature of the theme that I’m using.