matrix-org / matrix.to

A simple stateless privacy-protecting URL redirecting service for Matrix
http://matrix.to
Apache License 2.0
889 stars 189 forks source link

Add twitter embed meta tags #246

Closed calebccff closed 1 year ago

calebccff commented 2 years ago

Add embeds to make matrix invite links more obvious on twitter.

Links to matrix rooms are easily lost on twitter, especially if the same tweet includes a link to a site with embed support, example: image

Add meta tags for twitter so that if matrix.to links are posted first, they will be used for the embed, this will make them more obvious / appealing to click, this PR will result in tweets with matrix.to links looking like the following instead:

image

The title/description is just pulled from matrix.org, maintainers may want to make this something matrix.to specific or choose something that better represents the platform in this context.

calebccff commented 2 years ago

Instructions for easy local testing:

Make your changes, npm start, install ngrok and run ngrok http 5000 to tunnel your local server to the wider web.

Head to https://cards-dev.twitter.com/validator and paste the ngrok link to generate card previews.

calebccff commented 2 years ago

hi, any update on this?

calebccff commented 2 years ago

Hey! Is there anything I can do get this reviewed/merged?

thibaultamartin commented 2 years ago

This change is great and more than welcome! Thanks for suggesting it :)

It looks like only the landing page of matrix.to would get a Twitter card though. Pasting a link to a room returns ERROR: Required meta tag missing (twitter:url) on Twitter's card validator.

Any idea what could cause this?