mirror of
https://github.com/mastodon/mastodon
synced 2024-12-11 13:18:18 +09:00
1122579216
Reasoning: HTML title tag affects everyone. But OpenGraph only affects when somebody is deliberately sharing the content, usually in an environment where such content is expected. Hiding the content in OpenGraph tags results in deceitful previews which inhibit the shareability of the post. Example: Somebody writes a clever post about politics but kindly puts a "uspol" content warning on it. Mastodon users are thankful, but sharing this post on another platform results in non-Mastodon users believing the entire contents of the post is "uspol" and not clicking through/reading and re-sharing.
26 lines
1.3 KiB
Plaintext
26 lines
1.3 KiB
Plaintext
- if activity.is_a?(Status) && activity.media_attachments.any?
|
|
- activity.media_attachments.each do |media|
|
|
- if media.image?
|
|
= opengraph 'og:image', full_asset_url(media.file.url(:original))
|
|
= opengraph 'og:image:type', media.file_content_type
|
|
- unless media.file.meta.nil?
|
|
= opengraph 'og:image:width', media.file.meta['original']['width']
|
|
= opengraph 'og:image:height', media.file.meta['original']['height']
|
|
- elsif media.video?
|
|
= opengraph 'og:image', full_asset_url(media.file.url(:small))
|
|
= opengraph 'og:image:type', 'image/png'
|
|
- unless media.file.meta.nil?
|
|
= opengraph 'og:image:width', media.file.meta['small']['width']
|
|
= opengraph 'og:image:height', media.file.meta['small']['height']
|
|
= opengraph 'og:video', full_asset_url(media.file.url(:original))
|
|
= opengraph 'og:video:type', media.file_content_type
|
|
- unless media.file.meta.nil?
|
|
= opengraph 'og:video:width', media.file.meta['small']['width']
|
|
= opengraph 'og:video:height', media.file.meta['small']['height']
|
|
= opengraph 'twitter:card', 'summary_large_image'
|
|
- else
|
|
= opengraph 'og:image', full_asset_url(account.avatar.url(:original))
|
|
= opengraph 'og:image:width', '120'
|
|
= opengraph 'og:image:height','120'
|
|
= opengraph 'twitter:card', 'summary'
|