1
0
Fork 0
mirror of https://framagit.org/framasoft/mobilizon.git synced 2024-12-26 01:38:36 +00:00
mobilizon/lib/service/metadata/actor.ex
Thomas Citharel d4d295eae1
Add proxy route and proxify pics everywhere
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2019-05-28 10:55:13 +02:00

23 lines
837 B
Elixir

defimpl Mobilizon.Service.Metadata, for: Mobilizon.Actors.Actor do
alias Phoenix.HTML.Tag
alias Mobilizon.Actors.Actor
alias MobilizonWeb.MediaProxy
def build_tags(%Actor{} = actor) do
tags = [
Tag.tag(:meta, property: "og:title", content: Actor.display_name_and_username(actor)),
Tag.tag(:meta, property: "og:url", content: actor.url),
Tag.tag(:meta, property: "og:description", content: actor.summary),
Tag.tag(:meta, property: "og:type", content: "profile"),
Tag.tag(:meta, property: "profile:username", content: actor.preferred_username),
Tag.tag(:meta, property: "twitter:card", content: "summary")
]
if is_nil(actor.avatar) do
tags
else
tags ++
[Tag.tag(:meta, property: "og:image", content: actor.avatar.url |> MediaProxy.url())]
end
end
end