New Site Part 3
By Jon Archer
Since I setup the new version of this blog using Hugo, hosted on Cloudfront, I put together a Grafana instance to monitor traffic hitting the CDN. I noticed quite a number of errors and realised these would be dead links out in the wild. I wondered if I might figure a way of replicating the path structure I had with WordPress over here on Hugo.
Initially I looked at the behaviours on the CloudFront distribution and figured quite quickly that it needed to be a Lambda@Edge. So I started writing something that would perform the redirects for me. This seemed a lot of work for what would be relatively straight forward in something like NGinx, but hey ho.. I then realised that there would be Lambda invocation costs associated with doing this, and not being one willing to spend more than I have to with AWS I tried to look elsewhere.
I soon found myself here and that adding
[permalinks] 'blog' = '/:year/:month/:filename/'
to your config.toml file does the trick. Consider me further impressed with Hugo.
This caused the blog page to go a little haywire as pages were being generated differently from when I first created the Blog category, so not being indexed correctly. Further down the page I mentioned further up it talked about Aliases, while it took me a little while to update each page this approach seemed more sensible.
aliases: - /2013/10/oggcamp-linuxcon-europe-part-1-oggcamp
Adding the original path from Wordpress to the Front Matter similar to this will generate redirects to the blog posts and keeps the indexing working.