mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-05-20 11:14:27 -04:00
very, VERY hacky way to determine image width/height for meta tags
This commit is contained in:
@@ -1,10 +1,24 @@
|
||||
{{- $imagePath := "null" -}}
|
||||
|
||||
{{- if .Params.image }}
|
||||
{{ $imagePath = (printf "%s%s%s%s" "content" (.OutputFormats.Get "html").RelPermalink "images/" .Params.image ) }}
|
||||
{{- else }}
|
||||
{{ $imagePath = "content/me_large.jpg" }}
|
||||
{{- end -}}
|
||||
|
||||
{{- $imageResource := resources.Get $imagePath }}
|
||||
{{- .Scratch.Set "image" $imageResource }}
|
||||
{{- $image := .Scratch.Get "image" -}}
|
||||
|
||||
<meta property="og:title" content="{{ .Title }}">
|
||||
<meta property="og:site_name" content="{{ .Site.Title }}">
|
||||
<meta property="og:type" content="{{ if .IsHome }}website{{ else }}article{{ end }}">
|
||||
<meta property="og:locale" content="en_US">
|
||||
<meta property="og:url" content="{{ .Permalink }}">
|
||||
<meta property="og:description" content="{{ if .Description }}{{ .Description }}{{ else }}{{ .Site.Params.description }}{{ end }}">
|
||||
<meta property="og:image" content="{{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_lg.jpg" | absURL }}{{ end }}">
|
||||
<meta property="og:image" content="{{ if .Params.image }}{{ (printf "%s%s%s" (.OutputFormats.Get "html").Permalink "images/" .Params.image ) }}{{ else }}{{ "me_large.jpg" | absURL }}{{ end }}">
|
||||
<meta property="og:image:width" content="{{ $image.Width }}">
|
||||
<meta property="og:image:height" content="{{ $image.Height }}">
|
||||
{{- if .IsPage }}
|
||||
{{- if not .PublishDate.IsZero }}
|
||||
<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTMLAttr }}">
|
||||
|
||||
Reference in New Issue
Block a user