brainbaking/themes/brainbaking-minimal/layouts/partials/head-meta.html

140 lines
5.0 KiB
HTML
Raw Normal View History

2021-06-15 17:56:08 +02:00
{{ $perm := .Permalink }}
{{ $logo := "img/avatar-icon.png" }}
2020-05-27 21:20:01 +02:00
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
2021-06-15 17:56:08 +02:00
<link rel="canonical" href="{{ $perm }}">
<link rel="me" title="Mastodon" href="{{ .Site.Author.mastodonlink }}" />
2021-02-28 12:48:24 +01:00
<link rel="me" title="Github" href="{{ .Site.Author.githublink }}" />
<link rel="author" href="{{ .Site.BaseURL }}humans.txt" type="text/plain" />
2021-03-08 17:16:36 +01:00
<link rel="webmention" href="https://jam.brainbaking.com/webmention" />
<link rel="pingback" href="https://jam.brainbaking.com/pingback" />
2018-07-25 09:47:59 +02:00
<!-- meta data tags, open graph -->
<meta name="twitter:title" content="{{ .Title }}" property="og:title">
2020-12-14 08:57:46 +01:00
{{ $isHomePage := eq .Title .Site.Title }}
2018-07-24 21:43:40 +02:00
{{ if .Params.subtitle }}
<meta name="description" content="{{ .Params.subtitle }}. {{ .Summary | safeHTML }}">
<meta name="twitter:description" content="{{ .Params.subtitle }}" property="og:description">
2018-07-24 21:43:40 +02:00
{{ else }}
<meta name="description" content="{{ .Summary | safeHTML }}">
<meta name="twitter:description" content="{{ .Summary | safeHTML }}" property="og:description">
{{ end }}{{ if .Keywords }}
<meta content="{{ delimit .Keywords ", " }}" name="keywords">
2018-07-24 21:43:40 +02:00
{{ else if .Params.tags }}
<meta content="{{ delimit .Params.tags ", " }}" name="keywords">
2018-07-24 21:43:40 +02:00
{{ end }}
2021-06-15 17:56:08 +02:00
<meta name="twitter:card" content="summary_large_image">
<meta property="og:url" content="{{ $perm }}" />
2018-07-24 21:43:40 +02:00
<meta property="og:type" content="{{ if .Params.type }}{{ .Params.type }}{{ else }}website{{ end }}" />
2021-06-15 17:56:08 +02:00
{{ $thumb := $logo | absURL }}
2018-07-24 21:43:40 +02:00
{{ if .Params.bigimg }}
{{- $image := resources.Get (printf "%s%s" "bigimg/" .Params.bigimg ) -}}
{{ if eq $image nil }}
{{ else }}
{{- $imgsmall := $image.Resize "768x jpg q70" }}
2021-06-15 17:56:08 +02:00
{{ $thumb = $imgsmall.Permalink }}
{{- $imgmedium := $image.Resize "960x jpg q85" }}
<meta property="og:image:width" content="{{ $imgsmall.Width }}" />
2021-06-15 17:56:08 +02:00
<meta property="og:image:height" content="{{ $imgsmall.Height }}" />
<style>
.big-img {
background-image: url({{ $imgsmall.RelPermalink }}) !important;
}
@media (min-width: 768px) {
.big-img {
background-image: url({{ $imgmedium.RelPermalink }}) !important;
}
}
@media (min-width: 960px) {
.big-img {
background-image: url({{ $image.RelPermalink }}) !important;
}
}
</style>
{{ end }}
2021-06-15 17:56:08 +02:00
{{ else }}
{{ $match := findRE `!\[\]\((.+).jpg` .RawContent 1 }}
{{ range $match }}
{{ $relthumb := replace . "![](" "" }}
{{ $thumb = printf "%s%s" $perm $relthumb }}
{{ end }}
2018-07-24 21:43:40 +02:00
{{ end }}
2021-06-15 17:56:08 +02:00
<meta name="twitter:image" property="og:image" content="{{ $thumb }}" />
<meta name="twitter:image:alt" content="{{ .Params.subtitle }}">
2018-07-24 21:43:40 +02:00
<!-- zie sidebar.html, zelfde logica gebruikt -->
2021-06-15 17:56:08 +02:00
{{ $related := first 3 (where (where (where .Site.Pages.ByDate.Reverse ".Type" "==" "post") ".Params.tags" "intersect" .Params.tags) "Permalink" "!=" $perm) }}
2018-07-24 21:43:40 +02:00
{{ if $related }}
{{ range $related }}
2021-06-15 17:56:08 +02:00
<meta property="og:see_also" content="{{ $perm }}" />
2018-07-24 21:43:40 +02:00
{{ 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 -->
2018-07-25 09:47:59 +02:00
<!-- structured data -->
2020-06-09 13:45:59 +02:00
{{ $ISO8601 := "2006-01-02T15:04:05-07:00" }}
2018-07-25 09:47:59 +02:00
<script type="application/ld+json">
{
"@context" : "http://schema.org",
"@type" : "BlogPosting",
"mainEntityOfPage": {
"@type": "WebPage",
2020-06-09 13:45:59 +02:00
"@id": {{ .Site.BaseURL }}
2018-07-25 09:47:59 +02:00
},
"articleSection" : "{{ .Section }}",
2020-06-09 13:45:59 +02:00
"name" : {{ .Title }},
{{ if .Params.subtitle }}
2020-06-09 13:45:59 +02:00
"headline" : {{ .Params.subtitle }},
{{ else }}
2020-06-09 13:45:59 +02:00
"headline" : {{ .Title }},
{{ end }}
2020-06-09 13:45:59 +02:00
"description" : {{ if .Description }}{{ .Description }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ end }}{{ end }},
{{ if isset .Params "language" }}
"inLanguage" : "{{ .Params.language }}",
{{ else }}
"inLanguage" : "en-US",
{{ end }}
2020-06-09 12:16:37 +02:00
"isFamilyFriendly": "true",
2021-06-15 17:56:08 +02:00
"image": {{ $thumb }},
2018-07-25 09:47:59 +02:00
"author" : {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
2020-06-09 12:16:37 +02:00
"creator" : {
"@type": "Person",
"name": "{{ .Site.Author.name }}"
},
2018-07-25 09:47:59 +02:00
"publisher": {
"@type": "Organization",
"name": "{{ .Site.Title }}",
2020-06-09 12:16:37 +02:00
"url": {{ .Site.BaseURL }},
2018-07-25 09:47:59 +02:00
"logo": {
"@type": "ImageObject",
2020-06-09 13:45:59 +02:00
"url": {{ $logo | absURL }},
2020-06-09 12:16:37 +02:00
"width":"32",
"height":"32"
2018-07-25 09:47:59 +02:00
}
},
2018-07-25 09:47:59 +02:00
"accountablePerson" : "{{ .Site.Author.name }}",
2020-06-09 12:16:37 +02:00
"copyrightHolder" : "{{ .Site.Title }}",
2018-07-25 09:47:59 +02:00
"copyrightYear" : "{{ .Date.Format "2006" }}",
2020-06-09 13:45:59 +02:00
"dateCreated": {{ .Date.Format $ISO8601 }},
"datePublished": {{ .PublishDate.Format $ISO8601 }},
"dateModified": {{ .Lastmod.Format $ISO8601 }},
2021-06-15 17:56:08 +02:00
"url" : {{ $perm }},
2018-07-25 09:47:59 +02:00
"wordCount" : "{{ .WordCount }}",
2020-11-19 10:50:03 +01:00
"keywords" : [ {{ if isset .Params "tags" }}{{ range .Params.tags }}{{ . }},{{ end }}{{ end }}{{ .Title }}, {{ .Section }} ]
2018-07-25 09:47:59 +02:00
}
</script>