2018-02-21 14:03:32 +00:00
|
|
|
{{ if .Params.image }}
|
2020-06-01 22:01:30 +01:00
|
|
|
{{ .Scratch.Set "image" .Params.image }}
|
2018-02-21 14:03:32 +00:00
|
|
|
{{ if hasPrefix .Params.image "resource:" }}
|
|
|
|
{{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }}
|
2022-01-03 14:56:53 +00:00
|
|
|
{{ .Scratch.Set "image" ($resource.Resize "800x").Permalink }}
|
2020-09-12 15:46:23 +01:00
|
|
|
{{ else if hasPrefix .Params.image "unsplash:" }}
|
|
|
|
{{ $unsplash_id := replace .Params.image "unsplash:" "" }}
|
|
|
|
{{ $query := querify "client_id" (getenv "UNSPLASH_ACCESS_KEY") }}
|
|
|
|
{{ $unsplash_data := (getJSON "https://api.unsplash.com/photos/" $unsplash_id "?" $query )}}
|
2022-01-03 14:56:53 +00:00
|
|
|
{{ .Scratch.Set "image" $unsplash_data.urls.regular }}
|
2018-02-21 14:03:32 +00:00
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
{{ $image := .Scratch.Get "image" }}
|
|
|
|
|
|
|
|
{{/* Twitter-specific tags */}}
|
2017-11-11 21:53:54 +00:00
|
|
|
<meta name="twitter:dnt" content="on" />
|
|
|
|
<meta name="twitter:card" content="summary_large_image" />
|
2021-03-13 20:48:00 +00:00
|
|
|
<meta name="twitter:site" content="@{{ .Site.Data.social.accounts.twitter.username }}" />
|
2017-11-11 21:53:54 +00:00
|
|
|
<meta name="twitter:title" content="{{ .Title | htmlUnescape }}" />
|
|
|
|
<meta name="twitter:description" content="{{ .Summary | plainify | chomp | htmlUnescape }}{{ if .Truncated }}...{{ end }}" />
|
|
|
|
<meta name="twitter:creator" content="{{ .Site.Data.social.accounts.twitter.username }}" />
|
2018-02-21 14:03:32 +00:00
|
|
|
|
2021-03-13 21:22:41 +00:00
|
|
|
{{ if gt .ReadingTime 2 }}
|
|
|
|
<meta name="twitter:label1" content="Reading time" />
|
|
|
|
<meta name="twitter:data1" content="{{ .ReadingTime }} min read" />
|
|
|
|
{{ end }}
|
|
|
|
|
2018-02-21 14:03:32 +00:00
|
|
|
{{ if $image }}
|
|
|
|
<meta name="twitter:image" content="{{ absURL $image }}" />
|
2017-11-11 21:53:54 +00:00
|
|
|
<meta name="twitter:image:alt" content="{{ .Title | htmlUnescape }}" />
|
|
|
|
{{ end }}
|
|
|
|
|
2018-02-21 14:03:32 +00:00
|
|
|
{{/* OpenGraph tags*/}}
|
2017-11-11 21:53:54 +00:00
|
|
|
<meta property="og:title" content="{{ .Title | htmlUnescape }}" />
|
|
|
|
<meta property="og:type" content="{{ .Kind }}" />
|
|
|
|
<meta property="og:url" content="{{ .Permalink }}" />
|
|
|
|
<meta property="og:description" content="{{ .Summary | plainify | chomp | htmlUnescape }}{{ if .Truncated }}...{{ end }}" />
|
|
|
|
<meta property="og:site_name" content="{{ title .Site.Title | htmlUnescape }}" />
|
|
|
|
<meta property="og:locale" content="{{ .Site.Language.Lang }}" />
|
|
|
|
|
2018-02-21 14:03:32 +00:00
|
|
|
{{ if $image }}
|
|
|
|
<meta property="og:image" content="{{ absURL $image }}" />
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
|
2017-11-11 21:53:54 +00:00
|
|
|
<meta itemprop="name" content="{{ .Title | htmlUnescape }}" />
|
|
|
|
<meta itemprop="description" content="{{ .Summary | plainify | chomp | htmlUnescape }}{{ if .Truncated }}...{{ end }}" />
|
2018-02-21 14:03:32 +00:00
|
|
|
|
|
|
|
{{ if $image }}
|
|
|
|
<meta itemprop="image" content="{{ absURL $image }}" />
|
2017-11-11 21:53:54 +00:00
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
<meta name="article:author" content="{{ title .Site.Params.author }}" />
|
|
|
|
<meta name="article:modified_time" content="{{ .Lastmod.Format .Site.Params.iso8601 }}" />
|
|
|
|
<meta name="article:published_time" content="{{ .Date.Format .Site.Params.iso8601 }}" />
|
|
|
|
<meta name="article:section" content="{{ .Type }}" />
|
|
|
|
<meta name="description" content="{{ .Summary | plainify | chomp | htmlUnescape }}{{ if .Truncated }}...{{ end }}" />
|
|
|
|
<meta name="author" content="{{ title .Site.Params.author }}" />
|
|
|
|
<meta name="canonical" content="{{ .Permalink }}" />
|
|
|
|
|
2022-01-01 13:36:37 +00:00
|
|
|
{{ if .Params.tags }}
|
|
|
|
{{ range (.Params.tags | sort) }}
|
|
|
|
<meta property="article:tag" content="{{ . }}" />
|
|
|
|
{{ end }}
|
2021-03-13 21:22:55 +00:00
|
|
|
{{ end }}
|
2018-02-21 14:03:32 +00:00
|
|
|
|
2017-11-11 21:53:54 +00:00
|
|
|
{{ range .AlternativeOutputFormats }}
|
|
|
|
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink }}">
|
|
|
|
{{ end }}
|