You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Meta documentation of open graph suggests to always use the og:image:width and og:image:height tags.
Use og:image:width and og:image:height Open Graph tags:
Using these tags will specify the image dimensions to the crawler
so that it can render the image immediately without having to asynchronously
download and process it.
Is there a reason, why they are missing in tpl/tplimpl/embedded/templates/opengraph.html?
Something a long those lines, would solve the missing card previews in WhatsApp, etc.
{{- with partial "_funcs/get-page-images" . }}
{{- range . | first 6 }}
<metaproperty="og:image" content="{{ .Permalink }}">
{{ with $.Page.Resources.Get .Image }}
<metaproperty="og:image:width" content="{{ .Width }}"><metaproperty="og:image:height" content="{{ .Height }}">
{{ end }}
{{- end }}
{{- end }}
The text was updated successfully, but these errors were encountered:
Is there a reason, why they are missing in tpl/tplimpl/embedded/templates/opengraph.html?
Not sure... a desire for consistent output perhaps?
The _funcs/get-page-images partial returns a permalink regardless of whether an image is a resource. For example, a permalink may be for an image in the static directory, or a remote image. Unless it's a resource, we don't have access to dimensions. Even if the image is a resource, it may have a media type that we can't decode (e.g., image/avif, image/svg+xml, etc.).
I don't see anything wrong with conditionally including width and height meta elements, but I'd change the partial to return width, height, and media type (if available) along with the permalink and relpermalink. I'm not sure why it optionally includes the resource itself, but I guess there's no harm in keeping it there.
Meta documentation of open graph suggests to always use the
og:image:width
andog:image:height
tags.Is there a reason, why they are missing in
tpl/tplimpl/embedded/templates/opengraph.html
?Something a long those lines, would solve the missing card previews in WhatsApp, etc.
The text was updated successfully, but these errors were encountered: