Enum.reduce(attachments, [], fn attachment, acc ->
rendered_tags =
Enum.reduce(attachment["url"], [], fn url, acc ->
Enum.reduce(attachments, [], fn attachment, acc ->
rendered_tags =
Enum.reduce(attachment["url"], [], fn url, acc ->
# TODO: Add additional properties to objects when we have the data available.
# Also, Whatsapp only wants JPEG or PNGs. It seems that if we add a second og:image
# object when a Video or GIF is attached it will display that in Whatsapp Rich Preview.
# TODO: Add additional properties to objects when we have the data available.
# Also, Whatsapp only wants JPEG or PNGs. It seems that if we add a second og:image
# object when a Video or GIF is attached it will display that in Whatsapp Rich Preview.
- {:meta,
- [property: "og:" <> media_type, content: Utils.attachment_url(url["href"])], []}
+ {:meta, [property: "og:audio", content: Utils.attachment_url(url["href"])], []}
- {:meta,
- [property: "og:" <> media_type, content: Utils.attachment_url(url["href"])], []},
+ {:meta, [property: "og:image", content: Utils.attachment_url(url["href"])], []},
{:meta, [property: "og:image:width", content: 150], []},
{:meta, [property: "og:image:height", content: 150], []}
| acc
{:meta, [property: "og:image:width", content: 150], []},
{:meta, [property: "og:image:height", content: 150], []}
| acc
- {:meta,
- [property: "og:" <> media_type, content: Utils.attachment_url(url["href"])], []}
+ {:meta, [property: "og:video", content: Utils.attachment_url(url["href"])], []}