hugo-theme-contentful/layouts/partials/head.html
foo-dogsquared 4e81d9ed48 v1.2.0
2020-05-12 16:31:55 +08:00

35 lines
1.4 KiB
HTML

<title>{{ if .IsHome }}{{ $.Site.Title | safeHTML }}{{ else }}{{ .Title | safeHTML }}{{ end }}</title>
<link rel="stylesheet" href="{{ "css/main.css" | absURL }}" />
{{- /* Some sane <meta> tags default */ -}}
{{ hugo.Generator }}
<meta charset="utf-8">
<meta name="author" content="{{ with .Param "author.name" }}{{ . }}{{ else }}{{ $.Site.Author.name }}{{ end }}" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="referrer" content="no-referrer" />
<meta name="description" content="{{ if (and (eq .Kind "home") .IsHome) }}{{ .Site.Title }}{{ else }}{{ .Summary | safeHTML }}{{ end }}" />
{{- template "_internal/twitter_cards.html" . -}}
{{- template "_internal/opengraph.html" . -}}
{{- /* Linking all of the output formats for discovery. */ -}}
{{- range .OutputFormats }}
{{- printf "<link rel=%q type=%q href=%q />" .Rel .MediaType.Type .Permalink | safeHTML }}
{{- end }}
{{- if eq (getenv "HUGO_ENV") "production" | or (eq .Site.Params.env "production") }}
{{ template "_internal/google_analytics_async.html" . }}
{{ template "_internal/disqus.html" . }}
{{- end }}
{{- /* Persistent theme.
It's a very small script so there's little effect on perceived performance. */ -}}
<script>
const theme = window.localStorage.getItem('theme');
if (theme) {
document.documentElement.dataset.theme = theme;
}
</script>