Create a Post Template in Hugo
Hugo offers the ability to create template files for your project. These Archetypes will make your life easier by pre-filling a blog post for you.
How To Create A New Template In your Hugo project, create a new Markdown file in the archetypes folder in the project directory, for example, archetypes/posts.md.
Here’s a template that creates a new draft post with the current date in a specified format. For the title section we parse the filename and use a regular expression to convert dashes to whitespace.
Move To Hugo With Netlify
I’ve moved this blog from Gatsby.js to Hugo. My build times have gone down from more than 7 minutes to a few seconds!
The slow build times with Gatsby have been an ongoing concern for me. I’ve slowly been creeping towards Netlify’s free 300-minutes-build-time cap.
Hugo runs a magnitude faster, and it integrates well with Netlify.
Hugo is a static site generator built with Golang. The project’s selling points are incredible speed, ease of use, and the ability to configure tons of settings.
Deploy Hugo Extended to Netlify: For Use with SASS/SCSS
The official Hugo Docs do a very good job at guiding you through the installation of Hugo, the static site generator written in Golang.
Setting up a local version of Hugo turned out to be a smooth experience (on Manjaro Linux/Arch Linux).
But as always, hosting and deployment can throw a wrench into the works.
My landing page website is built with Hugo Extended 0.54, ships to a private Gitlab repo and automatically deploys to Netlify, a hosting provider with tons of other features (free SSL certificates, automatic deployments, CDN, etc.
Netlify Hugo Sass Error
Yesterday I was working on my portfolio site. A local copy of Hugo, the static site generator written in Golang, worked fine on my machine.
But when I tried to deploy the site to Netlify, the builds failed with an error:
failed to transform resource: TOCSS: failed to transform "css/main.tmp.css" (text/x-sass): this feature is not available in your current Hugo version
The reason?
My website template uses Sass and PostCSS. This only works with the extended version of Hugo.