2020-07-09 17:24:28 +02:00
|
|
|
defimpl Mobilizon.Service.Metadata, for: Mobilizon.Discussions.Comment do
|
2019-03-04 17:20:18 +01:00
|
|
|
alias Phoenix.HTML.Tag
|
2020-07-09 17:24:28 +02:00
|
|
|
alias Mobilizon.Discussions.Comment
|
2019-03-04 17:20:18 +01:00
|
|
|
|
2021-09-10 11:30:12 +02:00
|
|
|
@spec build_tags(Comment.t(), String.t()) :: list(Phoenix.HTML.safe())
|
|
|
|
def build_tags(%Comment{deleted_at: nil} = comment, _locale) do
|
2019-03-04 17:20:18 +01:00
|
|
|
[
|
|
|
|
Tag.tag(:meta, property: "og:title", content: comment.actor.preferred_username),
|
|
|
|
Tag.tag(:meta, property: "og:url", content: comment.url),
|
|
|
|
Tag.tag(:meta, property: "og:description", content: comment.text),
|
|
|
|
Tag.tag(:meta, property: "og:type", content: "website"),
|
|
|
|
Tag.tag(:meta, property: "twitter:card", content: "summary")
|
|
|
|
]
|
|
|
|
end
|
2021-09-10 11:30:12 +02:00
|
|
|
|
|
|
|
def build_tags(%Comment{} = _comment, _locale), do: []
|
2019-03-04 17:20:18 +01:00
|
|
|
end
|