jefklakscodex/themes/jefklak-creative-portfolio/layouts/partials/head.html

128 lines
5.5 KiB
HTML

{{ $perm := .Permalink }}
{{ $base := .Site.BaseURL }}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
{{- if .Title }}
<title>{{ .Title }} | {{ .Site.Title }}</title>
{{- else }}
<title>{{ .Site.Title }}</title>
{{ end }}
<meta content="{{ .Title }} | {{ .Site.Title }}" property="og:title">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="all,follow">
<meta name="googlebot" content="index,follow,snippet,archive">
<link rel="me" title="Mastodon" href="{{ .Site.Author.mastodonlink }}" />
<link rel="me" title="Github" href="{{ .Site.Author.githublink }}" />
<link rel="author" href="{{ $base }}humans.txt" type="text/plain" />
{{- if .Description }}
<meta name="description" content="{{ .Title }}. {{ .Description | safeHTML }} Via {{ .Site.Title }}">
<meta content="{{ .Title }}. {{ .Description | safeHTML }} Via {{ .Site.Title }}" property="og:description">
{{- else }}
<meta name="description" content="{{ .Title }}. {{ .Summary | safeHTML }}">
<meta content="{{ .Title }}. {{ .Summary | safeHTML }} Via {{ .Site.Title }}" property="og:description">
{{ end }}
{{- if .Keywords }}
<meta content="{{ delimit .Keywords ", " }}, {{ .Title }}" name="keywords">
{{- else if .Params.tags }}
<meta content="{{ delimit .Params.tags ", " }}, {{ .Title }}" name="keywords">
{{ end }}
<!-- opengraph meta -->
<!-- see https://github.com/nozzle/hugo-snippets/blob/master/layouts/partials/head/seo/open_graph.html -->
<meta property="og:url" content="{{ $perm }}" />
<meta property="og:type" content="{{ if .Params.type }}{{ .Params.type }}{{ else }}website{{ end }}" />
{{- $thumb := "img/favicon.png" | absURL }}
{{- if .Params.image }}
{{- $thumb = .Params.image | absURL }}
{{- else if .Params.howlongtobeat_id }}
{{- $thumb = printf "%s%s" $perm "cover.jpg" | absURL }}
{{- else }}
{{- $match := findRE `!\[(.*)\]\((.+).(jpg|png|gif)` .RawContent 1 }}
{{- range $match }}
{{- $relthumb := replaceRE `!\[(.*)\]\(` "" . }}
{{- if hasPrefix $relthumb "/" }}
{{- $thumb = printf "%s%s" $base $relthumb }}
{{- else }}
{{- $thumb = printf "%s%s" $perm $relthumb }}
{{ end }}
{{ end }}
{{ end }}
<meta property="og:image" content="{{ $thumb }}" />
<!-- zie sidebar.html, zelfde logica gebruikt -->
{{- $related := first 3 (where (where (where .Site.Pages.ByDate.Reverse ".Type" "==" "articles") ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" $perm) }}
{{- if $related }}
{{- range $related }}
<meta property="og:see_also" content="{{ $perm }}" />
{{ end }}
{{ end }}
<meta property="article:published_time" content="{{ .PublishDate }}" />
<meta property="article:modified_time" content="{{ .Date }}" />
<meta property="article:section" content="{{ .Section }}" />
{{- with .Params.tags }}{{ range first 6 . }}
<meta property="article:tag" content="{{ . }}" />
{{ end }}{{ end }}
<!-- end og -->
<!-- structured data -->
{{- $ISO8601 := "2006-01-02T15:04:05-07:00" }}
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": {{ $base }}
},
"articleSection" : "{{ .Section }}",
"name" : {{ .Title }},
"headline" : {{ .Title }},
"description" : {{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }},
"inLanguage" : "{{ .Site.LanguageCode }}",
"image": {{ $thumb }},
"author" : {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
"creator" : {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
"publisher": {
"@type": "Organization",
"name": "Brain Baking",
"url": {{ $base }}
},
"accountablePerson" : "{{ .Site.Author.name }}",
"copyrightHolder" : "{{ .Site.Author.name }}",
"copyrightYear" : "{{ .Date.Format "2006" }}",
"dateCreated": {{ .Date.Format $ISO8601 }},
"datePublished": {{ .PublishDate.Format $ISO8601 }},
"dateModified": {{ .Lastmod.Format $ISO8601 }},
"url" : {{ $perm }},
"wordCount" : "{{ .WordCount }}",
{{ if .Keywords }}
"keywords" : [ {{ range .Keywords }}{{ . }},{{ end }}{{ .Title }} ],
"genre" : [ {{ range .Keywords }}{{ . }},{{ end }}{{ .Title }} ]
{{ else if .Params.tags }}
"keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}{{ . }},{{ end }}{{ end }}{{ .Title }} ],
"genre" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}{{ . }},{{ end }}{{ end }}{{ .Title }} ]
{{ else }}
"keywords": [ {{ .Title }} ]
{{ end }}
}
</script>
<link rel="preload" href="{{ "css/simple-lightbox.min.css" | absURL }}" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript>
<link rel="stylesheet" href="{{ "css/simple-lightbox.min.css" | absURL }}">
</noscript>
{{- $options := (dict "targetPath" "css/styles.css" "outputStyle" "compressed" "enableSourceMap" "true") -}}
{{- $styles := resources.Get "sass/main.sass" | resources.ExecuteAsTemplate "main.sass" . | resources.ToCSS $options | resources.Fingerprint "sha512" }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
<link rel="shortcut icon" href="{{ "img/favicon.png" | absURL }}">
{{ with .OutputFormats.Get "RSS" }}
<link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="Jefklak's Codex" />
<link href="{{ .RelPermalink }}" rel="feed" type="application/rss+xml" title="Jefklak's Codex" />
{{ end }}