Hugo

Compiling website

  </div>
# Recompile
hugo --gc
  </div>
# Recompile in developer friendly mode
# -D Enabled compiling drafts
# -F content with future post dates
# - ignore cache
hugo -D -F --ignoreCache
  </div>
# Recompile assets for production
# - remove unused cache after build
# - minify supported output
hugo --gc --minify

Working locally

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

Letting Hugo Scaffold New Content

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

Theming

Dumping variable in theme

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

Conditional check for homepage

  </div>
<!--Available within Page Object -->
{{ if .IsHome }}
  <h1>Homepage!</h1>
{{ end}

Trim whtie space

  </div>
{{ Prints "as-is" }}
{{- Trims white space before }}
{{ Trims white space after -}}
{{- Trims white space before and after -}}