mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-07-21 08:01:16 -04:00
detect image properties for meta tags without hacky mounts
still a little hacky re: permalinks though....
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{{- $image := "" }}
|
||||
{{- $imagePath := "" }}
|
||||
{{- with .Params.image }}
|
||||
{{- $image = resources.Get (printf "%s%s%s%s" "content" ($.OutputFormats.Get "html").RelPermalink "images/" .) }}
|
||||
{{- $imagePath = (path.Join "content" $.File.Dir "images/" .) }}
|
||||
{{- end }}
|
||||
|
||||
<script type="application/ld+json">
|
||||
@@ -29,10 +29,10 @@
|
||||
"width": "2048",
|
||||
"height": "2048"
|
||||
}
|
||||
}{{ with $image }},
|
||||
}{{ with (imageConfig $imagePath) }},
|
||||
"image": {
|
||||
"@type": "ImageObject",
|
||||
"url": {{ replace .Permalink "/content/" "/" }},
|
||||
"url": {{ replace $imagePath "content/" $.Site.BaseURL }},
|
||||
"width": "{{ .Width }}",
|
||||
"height": "{{ .Height }}"
|
||||
}
|
||||
|
Reference in New Issue
Block a user