{{ if .Params.image }} {{ .Scratch.Set "image" .Params.image }} {{ if hasPrefix .Params.image "resource:" }} {{ $resource := .Resources.GetMatch (replace .Params.image "resource:" "") }} {{ .Scratch.Set "image" ($resource.Resize "800x").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.regular }} {{ end }} {{ end }} {{ $image := .Scratch.Get "image" }} {{/* Twitter-specific tags */}} {{ if gt .ReadingTime 2 }} {{ end }} {{ if $image }} {{ end }} {{/* OpenGraph tags*/}} {{ if $image }} {{ end }} {{ if $image }} {{ end }} {{ if .Params.tags }} {{ range (.Params.tags | sort) }} {{ end }} {{ end }} {{ range .AlternativeOutputFormats }} {{ end }}