Bryan's Blog

How I Build My Site

I'm still using the hugo static site generator, and the following makefile to help me build new posts:


	rsync -avz public/

	@bash -c 'read -p "Post title: " title; \
		DATE=`date --rfc-3339=date`;   \
		SAFE_TITLE=`echo $$title \
			| tr -d "[:punct:]" \
			| tr " " "-" \
			| tr "[:upper:]" "[:lower:]"`; \
		FILE_NAME="post/$$DATE-$$"; \
		hugo new $$FILE_NAME; \
		sed -i "s/title:.*/title: \"$$title\"/" \

Looks terrible eh. The gain is that building my site is as easy as typing make. Creating a new post is as simple as make post (it asks me for a title and creates the markdown file with the proper date stamp). Finally, publishing it is make publish. Feel free to use this if you want. Obviously change the server name and remote file location to wherever it is that you host your website.