fix meta tag for twitter cards and image attachments
The name of the tag should be twitter:image, not twitter:player. Also, add twitter:image:alt meta tags.
This commit is contained in:
parent
b6b7de2010
commit
52368e6702
1 changed files with 10 additions and 2 deletions
|
@ -76,9 +76,11 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCard do
|
||||||
{:meta, [name: "twitter:card", content: "summary_large_image"], []},
|
{:meta, [name: "twitter:card", content: "summary_large_image"], []},
|
||||||
{:meta,
|
{:meta,
|
||||||
[
|
[
|
||||||
name: "twitter:player",
|
name: "twitter:image",
|
||||||
content: MediaProxy.url(url["href"])
|
content: MediaProxy.url(url["href"])
|
||||||
], []}
|
], []},
|
||||||
|
{:meta, [property: "twitter:image:alt", content: truncate(attachment["name"])],
|
||||||
|
[]}
|
||||||
| acc
|
| acc
|
||||||
]
|
]
|
||||||
|> maybe_add_dimensions(url)
|
|> maybe_add_dimensions(url)
|
||||||
|
@ -130,4 +132,10 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCard do
|
||||||
metadata
|
metadata
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp truncate(text) do
|
||||||
|
# truncate to 420 characters
|
||||||
|
# see https://developer.twitter.com/en/docs/twitter-for-websites/cards/overview/markup
|
||||||
|
Pleroma.Formatter.truncate(text, 420)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue