My favourite files for making websites with Hugo.
- Stripped-down, boilerplate structure
- Works as a starting point for a theme
- Rich, semantic HTML (with templates featuring OpenGraph, Schema.org, Dublin Core)
- Clean, basic markup for the basic pages (list, single)
- Useful code snippets, such as menu templates
- Write more effective CSS with PostCSS (Autoprefixer, nested SASS-like syntax, purgeCSS, import)
- Ready for TailwindCSS
Requires NodeJS v10+ (to build assets with PostCSS-CLI).
npm install
Start a local server (http://localhost:1313 by default):
npm run serve # hugo serve --disableFastRender --buildDrafts --buildFuture
Build the site in the public/
directory:
npm run build # rm -rf public && hugo --minify
Once the files are built in public/
, it’s only a matter of copying them to the webserver.
There are many ways to achieve this.
Here’s a simple solution using Rsync.
Transfer the files using Rsync.
This requires prior editing of the commands/deploy.sh
file to match your configuration.
npm run deploy # ./commands/deploy.sh
{{< img src="/path/to/img.jpg" class="custom-class" title="Title (optional)" caption="Caption (optional)" >}}
Params:
alt
(string): alternative text if image cannot be displayed.class
(string): add a class to the<figure>
object.caption
(string): optional caption. Also translates to thealt
img attributesrc
(string): path to image. Must be an absolute path or relative to project root.title
(string): optional title.