How I Build My Site

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

all:
	hugo

publish:
	rsync -avz public/ bryanstamour.com:public_html/

post:
	@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-$$SAFE_TITLE.md"; \
		hugo new $$FILE_NAME; \
		sed -i "s/title:.*/title: \"$$title\"/" \
			content/$$FILE_NAME'

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.

 
comments powered by Disqus