{{ if .Params.image }} {{ .Scratch.Set "image" .Params.image }} {{ if hasPrefix .Params.image "resource:" }} {{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }} {{ .Scratch.Set "image" ($resource.Fill "800x418").Permalink }} {{ 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 )}} {{ .Scratch.Set "image" $unsplash_data.urls.small }} {{ end }} {{ end }} {{ $image := .Scratch.Get "image" }} {{/* Twitter-specific tags */}} <meta name="twitter:dnt" content="on" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:site" content="@{{ .Site.Data.social.accounts.twitter.username }}" /> <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 }}" /> {{ if gt .ReadingTime 2 }} <meta name="twitter:label1" content="Reading time" /> <meta name="twitter:data1" content="{{ .ReadingTime }} min read" /> {{ end }} {{ if $image }} <meta name="twitter:image" content="{{ absURL $image }}" /> <meta name="twitter:image:alt" content="{{ .Title | htmlUnescape }}" /> {{ end }} {{/* OpenGraph tags*/}} <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 }}" /> {{ if $image }} <meta property="og:image" content="{{ absURL $image }}" /> {{ end }} <meta itemprop="name" content="{{ .Title | htmlUnescape }}" /> <meta itemprop="description" content="{{ .Summary | plainify | chomp | htmlUnescape }}{{ if .Truncated }}...{{ end }}" /> {{ if $image }} <meta itemprop="image" content="{{ absURL $image }}" /> {{ 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 }}" /> {{ range .Params.tags }} <meta property="article:tag" content="{{ . }}" /> {{ end }} {{ range .AlternativeOutputFormats }} <link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink }}"> {{ end }}