2020-07-09 15:24:28 +00:00
|
|
|
defimpl Mobilizon.Service.Metadata, for: Mobilizon.Discussions.Comment do
|
2019-03-04 16:20:18 +00:00
|
|
|
alias Phoenix.HTML.Tag
|
2020-07-09 15:24:28 +00:00
|
|
|
alias Mobilizon.Discussions.Comment
|
2019-03-04 16:20:18 +00:00
|
|
|
|
2021-09-10 09:30:12 +00: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 16:20:18 +00: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 09:30:12 +00:00
|
|
|
|
|
|
|
def build_tags(%Comment{} = _comment, _locale), do: []
|
2019-03-04 16:20:18 +00:00
|
|
|
end
|