Clean up and improve generated OpenGraph tags (#4901)
- Return all images as og:image - Return videos as og:image (preview) and og:video - Return profile:username on profilesth-downstream
parent
e46f2d995f
commit
d4fd2a39e6
@ -1,8 +1,9 @@
|
|||||||
%meta{ property: 'og:url', content: url }/
|
= opengraph 'og:url', url
|
||||||
%meta{ property: 'og:site_name', content: site_title }/
|
= opengraph 'og:site_name', site_title
|
||||||
%meta{ property: 'og:title', content: [yield(:page_title).strip.presence, site_title].compact.join(' - ') }/
|
= opengraph 'og:title', [yield(:page_title).strip.presence, site_title].compact.join(' - ')
|
||||||
%meta{ property: 'og:description', content: account.note }/
|
= opengraph 'og:description', account.note
|
||||||
%meta{ property: 'og:image', content: full_asset_url(account.avatar.url(:original)) }/
|
= opengraph 'og:image', full_asset_url(account.avatar.url(:original))
|
||||||
%meta{ property: 'og:image:width', content: '120' }/
|
= opengraph 'og:image:width', '120'
|
||||||
%meta{ property: 'og:image:height', content: '120' }/
|
= opengraph 'og:image:height', '120'
|
||||||
%meta{ property: 'twitter:card', content: 'summary' }/
|
= opengraph 'twitter:card', 'summary'
|
||||||
|
= opengraph 'profile:username', account.local_username_and_domain
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
- if activity.is_a?(Status) && activity.spoiler_text?
|
- if activity.is_a?(Status) && activity.spoiler_text?
|
||||||
%meta{ property: 'og:description', content: activity.spoiler_text }/
|
= opengraph 'og:description', activity.spoiler_text
|
||||||
- else
|
- else
|
||||||
%meta{ property: 'og:description', content: activity.content }/
|
= opengraph 'og:description', activity.content
|
||||||
|
@ -1,6 +1,20 @@
|
|||||||
- if activity.is_a?(Status) && activity.non_sensitive_with_media?
|
- if activity.is_a?(Status) && activity.non_sensitive_with_media?
|
||||||
%meta{ property: 'og:image', content: full_asset_url(activity.media_attachments.first.file.url(:small)) }/
|
- 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
|
||||||
|
= 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'
|
||||||
|
= 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
|
||||||
|
= opengraph 'og:video:width', media.file.meta['small']['width']
|
||||||
|
= opengraph 'og:video:height', media.file.meta['small']['height']
|
||||||
- else
|
- else
|
||||||
%meta{ property: 'og:image', content: full_asset_url(account.avatar.url(:original)) }/
|
= opengraph 'og:image', full_asset_url(account.avatar.url(:original))
|
||||||
%meta{ property: 'og:image:width', content: '120' }/
|
= opengraph 'og:image:width', '120'
|
||||||
%meta{ property: 'og:image:height', content: '120' }/
|
= opengraph 'og:image:height','120'
|
||||||
|
Loading…
Reference in new issue