71 lines
2.2 KiB
HTML

{{- $config := site.Params }}
{{- $permalink := .Permalink }}
{{ $st := site.Title }}
{{- $summary := "" }}
{{- with .Summary }}
{{- $summary = . }}
{{- else }}
{{- $summary = $config.description }}
{{- end }}
{{- $summary = truncate 160 "" $summary }}
{{- $logo := absURL (printf "images/%s" $config.logo) }}
{{- if in $config.logo "https://" }}
{{- $logo = $config.logo }}
{{- end }}
{{ $image := "" }}
{{- with .Params.image }}
{{ if in . "https://" }}
{{- $image = . }}
{{ else }}
{{- $image = absURL (printf "images/%s" .) }}
{{ end }}
{{- else }}
{{- $image = $logo }}
{{- end }}
<meta name="keywords" content="{{ $st }}">
<meta property="og:locale" content='{{ default "en_US" $config.locale }}'>
<meta property="og:type" content="article">
<meta property="og:title" content="{{ .Title }}">
<meta property="og:description" content="{{ $summary }}">
<meta property="og:url" content="{{ $permalink }}">
<meta property="og:image" content="{{ $image }}">
{{- if eq .Section $config.blogDir -}}
{{- $date := .Date.Format "2006-02-01" -}}
<meta property="article:published_time" content="{{ htmlUnescape $date }}" />
<script type="application/ld+json">
{
"@context": "http://schema.org",
"@type": "BlogPosting",
"mainEntityOfPage":"{{ $permalink }}",
"name": "{{ $st }}",
"headline": "{{ .Title }}",
"description": "{{ $summary }}",
"url": "{{ $permalink }}",
"datePublished": "{{ $date }}",
"dateModified": "{{ $date }}",
"author": {
"@type": "Person",
"name": "{{ .Params.author }}"
},
"image":{
"@type":"ImageObject",
"url": "{{ $image }}"
},
"publisher": {
"@type": "Organization",
"logo": {
"@type":"ImageObject",
"url": "{{ $logo }}"
},
"name": "{{ $st }}"
}
}
</script>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:creator" content="{{ $config.twitter }}">
<meta name="twitter:title" content="{{ .Title }}">
<meta name="twitter:description" content="{{ $summary }}">
<meta name="twitter:image" content="{{ $image }}">
{{- end }}
<link rel="canonical" href="{{ $permalink }}">