head

The head.html partial layout includes:

  • All metadata for every page
  • A link to the bundled & minified CSS (@head/css.html)
  • A link to the bundled & minified JS (@head/js.html)

How it works

  1. The baseof.html default layout includes this partial using {{ partial "head.html" . }}.
  2. Each individual page’s layout inherits from baseof.html, ensuring it includes the head partial.
  3. Page front matter populates all metadata, used by the head partial.
  4. All asset links (CSS & JS) inject into the head section.

Source code

<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<meta name="title" content="{{with .Parent}}{{.Title}}{{end}}: {{ .Title }}" />
<meta name="description" content="{{with .Description}}{{.}}{{else}}{{.Summary}}{{end}}" />
<meta name="keywords" content="{{ .Keywords }}" />
<meta name="author" content="{{ .Params.author }}" />
{{ if .IsHome }}{{ hugo.Generator }}{{ end }}

<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
{{ partialCached "head/css.html" . }}
{{ partialCached "head/js.html" . }}