Wrong Twitter card if there are no attachments
In lib/pleroma/web/metadata/opengraph.ex
and lib/pleroma/web/metadata/twitter_card.ex
the meta tags inserted for a post that has no attachments (or which are hidden) include the author's profile image and card type summary_large_image
.
On Pleroma, my profile picture is an actual photo of myself; so if I make a text only post, share it on Friendica and look at my Twitter, I'm faced with a huge picture of my own face, which is scary.
I believe the type of Twitter card should be summary
in such cases. Also, no generic photo/avatar/etc should be included for posts that don't have any media. From the description for twitter:image
on "https://developer.twitter.com/en/docs/tweets/optimize-with-cards/overview/summary":
A URL to a unique image representing the content of the page. You should not use a generic image such as your website logo, author photo, or other image that spans multiple pages.
The following diff solved the issue for me on stable:
diff --git a/lib/pleroma/web/metadata/opengraph.ex b/lib/pleroma/web/metadata/opengraph.ex
index e7fa7f408..6a63e313f 100644
--- a/lib/pleroma/web/metadata/opengraph.ex
+++ b/lib/pleroma/web/metadata/opengraph.ex
@@ -49,10 +49,6 @@ defmodule Pleroma.Web.Metadata.Providers.OpenGraph do
] ++
if attachments == [] or Metadata.activity_nsfw?(object) do
[
- {:meta, [property: "og:image", content: Utils.attachment_url(User.avatar_url(user))],
- []},
- {:meta, [property: "og:image:width", content: 150], []},
- {:meta, [property: "og:image:height", content: 150], []}
]
else
attachments
diff --git a/lib/pleroma/web/metadata/twitter_card.ex b/lib/pleroma/web/metadata/twitter_card.ex
index d6a6049b3..44c2a7f7d 100644
--- a/lib/pleroma/web/metadata/twitter_card.ex
+++ b/lib/pleroma/web/metadata/twitter_card.ex
@@ -30,8 +30,7 @@ defmodule Pleroma.Web.Metadata.Providers.TwitterCard do
] ++
if attachments == [] or Metadata.activity_nsfw?(object) do
[
- image_tag(user),
- {:meta, [property: "twitter:card", content: "summary_large_image"], []}
+ {:meta, [property: "twitter:card", content: "summary"], []}
]
else
attachments