InkSoul/themes/meme_cdn/layouts/partials/head.html

121 lines
5.2 KiB
HTML

<head{{ if .Site.Params.openGraph }} prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article#"{{ end }}>
<meta charset="UTF-8" />
{{ hugo.Generator }}
{{- with .Site.Params.defaultTheme | default "light" -}}
{{- if eq . "light" -}}
<meta name="theme-color" content="{{ $.Site.Params.themeColor }}" />
{{- else -}}
<meta name="theme-color" content="{{ $.Site.Params.themeColorDark }}" />
{{- end -}}
{{- end -}}
<!-- https://web.dev/color-scheme/ -->
<meta name="color-scheme" content="light dark">
<!-- Responsive Web Design -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Avoid Automatic Format Detection -->
<meta name="format-detection" content="telephone=no, date=no, address=no, email=no" />
<!-- Avoid Transcoding -->
<meta http-equiv="Cache-Control" content="no-transform" />
<!-- Avoid Baidu Mobile Search Transcoding -->
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>{{ (partial "utils/title.html" (dict "$" . "title" .Title)).title }}</title>
<!-- CSS -->
{{- partial "style.html" . }}
<!-- JavaScript -->
{{ if ne .Kind "404" }}
{{ partial "script.html" . }}
{{ end }}
<!-- Fonts -->
{{- with .Site.Params.fontsLink -}}
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link rel="stylesheet" href="{{ . }}" media="print" onload="this.media='all'" />
<noscript><link rel="stylesheet" href="{{ . }}" /></noscript>
{{- end }}
<meta name="author" content="{{ .Params.author | default .Site.Author.name }}" />
{{- $description := .Description | default (partial "utils/summary.html" .) | default .Site.Params.siteDescription | plainify | htmlUnescape -}}
<meta name="description" content="{{ $description }}" />
<!-- Favicon, Icons, Web App -->
{{- $favicon := "favicon.ico" -}}
{{- $safariMaskIcon := "icons/safari-pinned-tab.svg" -}}
{{- $safariMaskColor := .Site.Params.safariMaskColor -}}
{{- $appleTouchIcon := "icons/apple-touch-icon.png" -}}
{{- $msApplicationStartURL := partial "utils/relative-url.html" (dict "$" . "filename" "") -}}
{{- $msApplicationTileColor := .Site.Params.msApplicationTileColor -}}
{{- $msApplicationTileImage := partial "utils/relative-url.html" (dict "$" . "filename" "icons/mstile-150x150.png") -}}
{{- $manifest := "manifest.json" -}}
<link rel="shortcut icon" href="{{ $favicon | relURL }}" type="image/x-icon" />
<link rel="mask-icon" href="{{ $safariMaskIcon | relURL }}" color="{{ $safariMaskColor }}" />
<link rel="apple-touch-icon" sizes="180x180" href="{{ $appleTouchIcon | relURL }}" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-title" content="{{ .Site.Title }}" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="mobile-web-app-capable" content="yes" />
<meta name="application-name" content="{{ .Site.Title }}" />
<meta name="msapplication-starturl" content="{{ $msApplicationStartURL }}" />
<meta name="msapplication-TileColor" content="{{ $msApplicationTileColor }}" />
<meta name="msapplication-TileImage" content="{{ $msApplicationTileImage }}" />
<link rel="manifest" href="{{ $manifest | relURL }}" />
<!-- Atom / RSS -->
{{ with .OutputFormats.Get "SectionsAtom" -}}
<link rel="{{ .Rel }}" type="{{ .MediaType }}" href="{{ .Permalink }}" title="{{ $.Site.Title }}" />
{{ end -}}
{{ with .OutputFormats.Get "SectionsRSS" -}}
<link rel="{{ .Rel }}" type="{{ .MediaType }}" href="{{ .Permalink }}" title="{{ $.Site.Title }}" />
{{ end }}
<!-- SEO -->
<link rel="canonical" href="{{ .Permalink }}" />
<!-- JSON-LD -->
{{- with .Site.Params.jsonLD -}}
{{ partial "utils/json-ld.html" (dict "$" $ "description" $description) }}
{{- end }}
<!-- Twitter Cards -->
{{- with .Site.Params.twitterCards -}}
{{ partial "utils/twitter-cards.html" (dict "$" $) }}
{{- end }}
<!-- Open Graph -->
{{- with .Site.Params.openGraph -}}
{{ partial "utils/open-graph.html" (dict "$" $ "description" $description) }}
{{- end }}
{{- with .Site.Params.googleSiteVerification }}
<meta name="google-site-verification" content="{{ . }}" />
{{- end }}
{{- if and .Site.Params.enableGoogleAnalytics (eq hugo.Environment "production") }}
<link rel="preconnect" href="https://www.google-analytics.com" crossorigin />
{{ partial "third-party/google-analytics.html" . }}
{{- end }}
{{- if or .Site.Params.enableGoogleAutoAds .Site.Params.enableGoogleAdUnits }}
{{ if eq hugo.Environment "production" }}
{{ partial "third-party/google-adsense.html" . }}
{{ end }}
{{- end }}
{{- if and .Site.Params.enableGoogleAutoAds (eq hugo.Environment "production") -}}
{{ partial "third-party/google-adsense-auto.html" . }}
{{- end }}
<!-- Yandex.Metrika -->
{{ if and .Site.Params.yandexMetrikaId (eq hugo.Environment "production") }}
{{ partial "third-party/yandex-metrika.html" . }}
{{- end }}
{{ partial "custom/head.html" . }}
</head>