Files
blog/themes/paper/layouts/partials/head.html
T

107 lines
2.8 KiB
HTML

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>
<!-- Title -->
<title>{{ if not .IsHome }}{{ .Title }} - {{ end }}{{ site.Title }}</title>
<!-- Meta -->
<meta name="theme-color" />
<!-- Author -->
{{ $site_author := or site.Author.name site.Params.name site.Title }}
<!---->
{{ if eq .Kind "page" }}
<meta name="description" content="{{ .Summary }}" />
<meta name="author" content="{{ or .Params.author $site_author }}" />
{{ else }}
<!---->
<meta
name="description"
content="{{ site.Params.description | default (print `A personal blog`) }}"
/>
<meta name="author" content="{{ $site_author }}" />
{{ end }}
<!-- CSS & JS -->
{{ $main := resources.Get "main.css" }}
<!---->
{{ $custom := resources.Get "custom.css" }}
<!---->
{{ $css := slice $main $custom | resources.Concat "main.css" | minify }}
<link rel="preload stylesheet" as="style" href="{{ $css.Permalink }}" />
<!-- Dark Icon -->
{{ $dark_icon := "theme.png" }}
<!---->
{{ if site.Params.monoDarkIcon }}{{ $dark_icon = "theme.svg" }}{{ end }}
<!---->
<link rel="preload" as="image" href="{{ $dark_icon | absURL }}" />
<!-- Avatar -->
{{ $avatar_url := $.Scratch.Get "avatar_url" }}
<!---->
{{ if $avatar_url }}
<link rel="preload" as="image" href="{{ $avatar_url }}" />
{{ end }}
<!---->
<!-- Social List -->
{{ range $.Scratch.Get "social_list" }}
<link rel="preload" as="image" href="{{ printf `%s.svg` . | absURL }}" />
{{ end }}
<!---->
<!-- Highlight JS -->
{{ if and .IsPage (not site.Params.disableHLJS) }}
<script
defer
src="{{ `highlight.min.js` | absURL }}"
onload="hljs.initHighlightingOnLoad();"
></script>
{{ end }}
<!-- Math -->
{{ if or .Params.math site.Params.math }}
<!---->
{{ partial "math.html" . }}
<!---->
{{ end }}
<!---->
<!-- Favicon -->
<link rel="icon" href="{{ site.Params.favicon | default `favicon.ico` | absURL }}" />
<link rel="apple-touch-icon" href="{{ site.Params.appleTouchIcon | default `apple-touch-icon.png` | absURL }}" />
<!-- Generator -->
{{ hugo.Generator }}
<!-- Production -->
{{ if or hugo.IsProduction (eq site.Params.env "production") }}
<!---->
{{ template "_internal/google_analytics.html" . }}
<!---->
{{ template "_internal/schema.html" . }}
<!---->
{{ template "_internal/opengraph.html" . }}
<!---->
{{ template "_internal/twitter_cards.html" . }}
<!-- RSS -->
{{ range .AlternativeOutputFormats }}
<link
rel="{{ .Rel }}"
type="{{ .MediaType.Type }}"
href="{{ .Permalink }}"
title="{{ site.Title }}"
/>
{{ end }}
<!-- Canonical -->
<link rel="canonical" href="{{ .Permalink }}" />
{{ end }}
<!---->
</head>