Hugo

Compiling website

1# Recompile
2hugo --gc
1# Recompile in developer friendly mode
2# -D Enabled compiling drafts
3# -F content with future post dates
4# - ignore cache
5hugo -D -F --ignoreCache
1# Recompile assets for production
2# - remove unused cache after build
3# - minify supported output
4hugo --gc --minify

Working locally

1# Run server locally with live reloading
2# e.g. http://localhost:1313
3hugo server
1# Select non-default theme
2# matches directory within /themes
3hugo server -t hugo-clarity
1# Work via local webserver
2# - enables drafts
3# - enables future dated content
4hugo server -D -F

Letting Hugo Scaffold New Content

1# Generate new content
2# - automatically sets the date
3# Selects the kind of post based on path
4# Attempts to find & use archetype
5`hugo new projects/some-new-project.md`
1# A kind of post can be specific with -k
2`hugo new -k gallery blog/photo-gallery.md`

Theming

Dumping variable in theme

1<!--Display variable debug info-->
2<pre>{{ debug.Dump .Params }}</pre>

Conditional check for homepage

1<!--Available within Page Object -->
2{{ if .IsHome }}
3  <h1>Homepage!</h1>
4{{ end}
comments powered by Disqus