The head.html
partial layout houses:
- all of the metadata that needs to be generated for every article
- a link to the bundled & minified CSS (@head/css.html)
- a link to the bundled & minified JS (@head/js.html)
How it Works #
- This partial is fed into the
baseof.html
default layout. - Each individual page is passed through this template as context
{{ partial "head.html" . }}
- All metadata is populated from page frontmatter.
- All assets are applied.
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" . }}