1
0
Fork 0
hugo-paper/layouts/partials/head.html
2023-08-15 04:50:08 +08:00

96 lines
2.5 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" />
{{ $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 }}
<!-- Styles & Scripts -->
{{ $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 }}" />
{{ if and .IsPage (not site.Params.disableHLJS) }}
<script
defer
src="{{ `highlight.min.js` | absURL }}"
onload="hljs.initHighlightingOnLoad();"
></script>
{{ end }}
<!-- Preload -->
{{ $dark_icon := "theme.png" }} {{ if site.Params.monoDarkIcon }} {{
$dark_icon = "theme.svg" }} {{ end }}
<link rel="preload" as="image" href="{{ $dark_icon | absURL }}" />
{{ $avatar_url := $.Scratch.Get "avatar_url" }}
<!---->
{{ if $avatar_url }}
<link rel="preload" as="image" href="{{ $avatar_url }}" />
{{ end }}
<!---->
{{ range $.Scratch.Get "social_list" }}
<link rel="preload" as="image" href="{{ printf `%s.svg` . | absURL }}" />
{{ end }}
<!---->
{{ if or .Params.math .Site.Params.math }}
<!---->
{{ partial "math.html" . }}
<!---->
{{ end }}
<!---->
<!-- Favicon -->
<link rel="icon" href="{{ `favicon.ico` | absURL }}" />
<link rel="apple-touch-icon" href="{{ `apple-touch-icon.png` | absURL }}" />
<!-- Generator -->
{{ hugo.Generator }}
<!-- RSS -->
{{ range .AlternativeOutputFormats }}
<link
rel="{{ .Rel }}"
type="{{ .MediaType.Type }}"
href="{{ .Permalink }}"
title="{{ site.Title }}"
/>
{{ end }}
<!-- Misc -->
{{ if or hugo.IsProduction (eq site.Params.env "production") }}
<!---->
{{ template "_internal/google_analytics.html" . }}
<!---->
{{ template "_internal/schema.html" . }}
<!---->
{{ template "_internal/twitter_cards.html" . }}
<!---->
{{ end }}
</head>