]> cat aescling's git repositories - mastodon.git/commitdiff
Add meta tags for OGP to following & follow page (#2052)
authorYamagishi Kazutoshi <ykzts@desire.sh>
Wed, 19 Apr 2017 15:17:32 +0000 (00:17 +0900)
committerEugen <eugen@zeonfederated.com>
Wed, 19 Apr 2017 15:17:32 +0000 (17:17 +0200)
* Add meta tags for OGP to following & follow page

* simplify render helper

* Follow up #2133

* og:type is only accounts/show

* revert accounts/{following,followers}

app/views/accounts/_og.html.haml [new file with mode: 0644]
app/views/accounts/show.html.haml
app/views/follower_accounts/index.html.haml
app/views/following_accounts/index.html.haml

diff --git a/app/views/accounts/_og.html.haml b/app/views/accounts/_og.html.haml
new file mode 100644 (file)
index 0000000..b7f019c
--- /dev/null
@@ -0,0 +1,7 @@
+%meta{ property: 'og:site_name', content: site_title }/
+%meta{ property: 'og:title', content: [yield(:page_title).strip.presence, site_title].compact.join(' - ') }/
+%meta{ property: 'og:description', content: account.note }/
+%meta{ property: 'og:image', content: full_asset_url(account.avatar.url(:original)) }/
+%meta{ property: 'og:image:width', content: '120' }/
+%meta{ property: 'og:image:height', content: '120' }/
+%meta{ property: 'twitter:card', content: 'summary' }/
index 44d66d4716a75bf12493352739b1e061bc4b8a34..4611155cddce953fa1a256efb49564bdb8fa2be7 100644 (file)
@@ -5,14 +5,8 @@
   %link{ rel: 'salmon', href: api_salmon_url(@account.id) }/
   %link{ rel: 'alternate', type: 'application/atom+xml', href: account_url(@account, format: 'atom') }/
 
-  %meta{ property: 'og:site_name', content: site_title }/
   %meta{ property: 'og:type', content: 'profile' }/
-  %meta{ property: 'og:title', content: "#{@account.username} on #{site_hostname}" }/
-  %meta{ property: 'og:description', content: @account.note }/
-  %meta{ property: 'og:image', content: full_asset_url(@account.avatar.url(:original)) }/
-  %meta{ property: 'og:image:width', content: '120' }/
-  %meta{ property: 'og:image:height', content: '120' }/
-  %meta{ property: 'twitter:card', content: 'summary' }/
+  = render 'og', account: @account
 
 - if show_landing_strip?
   = render partial: 'shared/landing_strip', locals: { account: @account }
index c30d601e61207efe2f01c86961913da06deb0fcd..4052967dab39a30de4ba0685feecef56bf85dc48 100644 (file)
@@ -1,6 +1,9 @@
 - content_for :page_title do
   = t('accounts.people_who_follow', name: display_name(@account))
 
+- content_for :header_tags do
+  = render 'accounts/og', account: @account
+
 = render 'accounts/header', account: @account
 
 = render 'accounts/follow_grid', accounts: @accounts
index cd3737591cbb7aa1bd42fe4a9acd350a7cc0b86e..11e730e0484281bd96a62e58e4ba580918a571f4 100644 (file)
@@ -1,6 +1,9 @@
 - content_for :page_title do
   = t('accounts.people_followed_by', name: display_name(@account))
 
+- content_for :header_tags do
+  = render 'accounts/og', account: @account
+
 = render 'accounts/header', account: @account
 
 = render 'accounts/follow_grid', accounts: @accounts