logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

_og_image.html.haml (1985B)


  1. - if activity.is_a?(Status) && activity.non_sensitive_with_media?
  2. - player_card = false
  3. - activity.media_attachments.each do |media|
  4. - if media.image?
  5. = opengraph 'og:image', full_asset_url(media.file.url(:original))
  6. = opengraph 'og:image:type', media.file_content_type
  7. - unless media.file.meta.nil?
  8. = opengraph 'og:image:width', media.file.meta.dig('original', 'width')
  9. = opengraph 'og:image:height', media.file.meta.dig('original', 'height')
  10. - elsif media.video? || media.gifv?
  11. - player_card = true
  12. = opengraph 'og:image', full_asset_url(media.file.url(:small))
  13. = opengraph 'og:image:type', 'image/png'
  14. - unless media.file.meta.nil?
  15. = opengraph 'og:image:width', media.file.meta.dig('small', 'width')
  16. = opengraph 'og:image:height', media.file.meta.dig('small', 'height')
  17. = opengraph 'og:video', full_asset_url(media.file.url(:original))
  18. = opengraph 'og:video:secure_url', full_asset_url(media.file.url(:original))
  19. = opengraph 'og:video:type', media.file_content_type
  20. = opengraph 'twitter:player', medium_player_url(media)
  21. = opengraph 'twitter:player:stream', full_asset_url(media.file.url(:original))
  22. = opengraph 'twitter:player:stream:content_type', media.file_content_type
  23. - unless media.file.meta.nil?
  24. = opengraph 'og:video:width', media.file.meta.dig('original', 'width')
  25. = opengraph 'og:video:height', media.file.meta.dig('original', 'height')
  26. = opengraph 'twitter:player:width', media.file.meta.dig('original', 'width')
  27. = opengraph 'twitter:player:height', media.file.meta.dig('original', 'height')
  28. - if player_card
  29. = opengraph 'twitter:card', 'player'
  30. - else
  31. = opengraph 'twitter:card', 'summary_large_image'
  32. - else
  33. = opengraph 'og:image', full_asset_url(account.avatar.url(:original))
  34. = opengraph 'og:image:width', '120'
  35. = opengraph 'og:image:height','120'
  36. = opengraph 'twitter:card', 'summary'