Some Site Changes

A little housekeeping.

I decided recently to make the switch from jekyll to hugo for my site. I do most of my writing in org mode rather than markdown these days inside of spacemacs . I'd looked into numerous ways of easing the workflow for generating new posts. Since I'm already taking notes in org mode, converting those notes into a post should be simple. But generating the site in jekyll was less so. There were too many steps. Also, upgrading the site and all it's ruby dependencies sometimes broke in annoying ways. Hugo is even simpler than jekyll.

Starting with v19, hugo includes native generation from org mode. So instead of having to go through multiple generation steps to first render a post from org mode to either markdown or html while preserving the front matter, I can just do hugo new post/whatever.org and front matter is added and the draft post is ready for editing. Once I'm satisfied with the post, I don't have to go through any extra steps to generate the site. Org is treated the same way as markdown and changing draft: true to false in frontmatter and running hugo is all that needs to happen.

Converting from jekyll to hugo was easier than I thought. There was a little trickery using the slug: keyword in front matter to retain the original site's structure (without dates in the path names). I've tried to preserve the overall site structure as I've made changes so google searches and any bookmarks don't break. Then I found a hugo theme I liked. Adding a few navigation headings through config.toml again to preserve some links to the old site structure, my resume, etc. was super easy.

The next step was deciding how to deploy. Since I use ansible so much these days, I came across this ansible role for deploying s3 bucket websites. Simply doing a ansible-playbook deploy.yaml after creating and testing a post locally does the job. Moving the site, then, was simply copying my original s3 bucket with aws s3 sync s3://oldbucket s3://newbucket then running the ansible-playbook deploy.yaml to include the new content. I removed --delete from the sync function for now in the ansible role. I may put the old site entirely in hugo's static/ dir so it's recreated on generation but for now most of the old static content is not included inside my hugo rep. It is rather large and would blow up the size of my site's git repo.

The last step was to point the AWS cloudfront origin to the new bucket hostname. Note that I don't point to the bucket but use a custom origin so index.html within subfolder works properly.

All in all I'd say it took a bit of debugging and maybe 3-4 hours of work overall. I did it over a couple of weeks taking my time when I had a few spare cycles. So hopefully there will be more content to come going forward!

 
comments powered by Disqus