site/layouts/partials/head.html

70 lines
3.0 KiB
HTML

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ if .Params.description }}{{ .Params.description }}{{ else }}{{ .Site.Params.Description }}{{ end }}">
<meta name="author" content="{{ .Site.Author.name }}">
<meta property="article:author" content="{{ .Site.Author.name }}">
{{ if gt .Date 0 -}}
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">
{{ end -}}
{{ if lt .Date .Lastmod -}}
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}">
{{- end -}}
<!--favicon-->
{{ $favicon_svg := resources.Get "/favicon.svg" | resources.Fingerprint "md5" }}
{{- printf `<link rel="icon" sizes="any" href="%s" type="image/svg+xml">` $favicon_svg.Permalink | safeHTML }}
{{ $favicon := resources.Get "/favicon.png" -}}
{{ $favicon_base64 := $favicon.Content | base64Encode }}
{{ printf `<link rel="icon" sizes="32x32" href="data:image/png;base64,%s" type="image/png">` $favicon_base64 | safeHTML }}
<link rel="webmention" href="https://webmention.io/hedy.tilde.cafe/webmention" />
<link rel="pingback" href="https://webmention.io/hedy.tilde.cafe/xmlrpc" />
<link rel="alternate" type="application/rss+xml" href="{{ .Site.BaseURL }}posts/index.xml" title="{{ $.Site.Title }}">
{{- if ne .Site.BaseURL "https://hedy.tilde.cafe/" -}}
<meta name="robots" content="noindex">
{{- end -}}
<meta name="color-scheme" content="light dark">
{{ $css := resources.Get "main.css" | minify -}}
<style>{{ $css.Content | safeCSS }}</style>
<!--
Syntax Highlighting ZONE :D
1. has different themes for light and dark mode
light = monokailight
dark = dracula!
2. Only adds the syntax css if the page needs it. The highlight param
is turned off by default, hence only posts and pages that have the
"highlight = true" will get this style :)
3. Doesn't require an extra request. The two CSS files are saved in my
assets, and is tracked with git.
4. IDK why but the dracula file had many classes set as just "{ }" and
makes it super unreadable in dark mode, so I've made all the blank ones
set color to white so it can be read in dark mode :>
-->
{{ if .Params.highlight -}}
{{ $syntaxlight := resources.Get "syntax/light.css" | minify -}}
{{ $syntaxdark := resources.Get "syntax/dark.css" | minify -}}
<style>
{{- $syntaxlight.Content | safeCSS }}
@media (prefers-color-scheme: dark) {
{{- $syntaxdark.Content | safeCSS -}}
}
</style>
{{ end -}}
<!-- END Syntax Highlighting ZONE!! -->
{{ if eq .Permalink $.Site.BaseURL -}}
<title>{{ $.Site.Title }}</title>
{{ else -}}
<title>{{ .Title }}{{ .Site.Params.suffixTitle }}</title>
{{ end -}}
<meta property="og:title" content="{{ .Title }}">
<meta property="og:site_name" content="{{ $.Site.Title }}">
{{- if (eq "page" .Kind) }}
<meta property="og:type" content="article">
{{ else -}}
<meta property="og:type" content="website">
{{ end -}}
<!-- TODO: Figure out the meta icons shit -->
{{ hugo.Generator }}