Skip to content

Opengraph/TwitterCard::summary for statuses and user profiles

Vlad Mikhailov requested to merge raeno/pleroma:oembed_provider into develop

Implementation details

  1. Pleroma-fe has special placeholder comment in section to be replaced with server generated tags.
  2. For supported routes we dynamically generate html response on the fly by reading priv/static/index.html from the disk and replacing placeholder with generated tags. I also like the idea of building index.html.eex template during compilation like @lambadalambda proposed in #197 but it's going to take day at least for me to make and I don't think current solution is worse from performance/simplicity perspectives.
  3. This behaviour is enabled by default but could be can be turned off by changing config :pleroma, :metadata, opengraph: <value> setting.

Supported routes

  • /notice/:id
  • /users/:id
  • /users/:nickname

How it looks like

User profile: Screenshot_2018-12-14_at_04.11.40

Text status: Screenshot_2018-12-14_at_03.52.14

About oEmbed

Initially that MR included oEmbed support, I removed it from here to have something valuable for users ready to merge. I'm going to open another one with all oEmbed code from this one and continue my work there. Basic implementation of oEmbed ( link type response ) doesn't provide any benefits over opengraph. It becomes useful when we could add html part to response and for that we need to render user profile or status card on server side, ideally using Vue rendered as on frontend.

Things to resolve before merging:

  • I changed order of formats for oStatus pipeline and put html on the first place. It makes links like https://<pleroma.site>/users/raeno to render html with metatags. Fetcher should provide Accept or ContentType header "application/xml" to get a xml response. I'm not sure if it breaks interaction via oStatus somehow or not. Asked on #dev channel in Slack
  • Probably somebody with UX experience should look at how statuses/user cards are unfurled.
  • Unfurl images/videos inside statuses
  • Fix tests, currently it fails because index.html doesn't contain necessary placeholder. I'll try to mock it tomorrow to avoid dependency on FE
Edited by rinpatch

Merge request reports