Poop Sheet

Leaf

Files named index.md (as opposed to _index.md) are leaves, and use layouts/page.html (historically layouts/single.html) as their template.

The template for layouts/page.html by hugo new theme whatever_name looks like this.

{{ define "main" }}
  <h1>{{ .Title }}</h1>

  {{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
  {{ $dateHuman := .Date | time.Format ":date_long" }}
  <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>

  {{ .Content }}
  {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
{{ end }}

The variables .Title and .Date access the values stored in the frontmatter’s title and date entries.