Skip to content

Commit

Permalink
Add meta tags for OGP to following & follow page (mastodon#2052)
Browse files Browse the repository at this point in the history
* Add meta tags for OGP to following & follow page

* simplify render helper

* Follow up mastodon#2133

* og:type is only accounts/show

* revert accounts/{following,followers}
  • Loading branch information
ykzts authored and Gargron committed Apr 19, 2017
1 parent fe1ddc3 commit 2510119
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions app/views/accounts/_og.html.haml
Original file line number Diff line number Diff line change
@@ -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' }/
8 changes: 1 addition & 7 deletions app/views/accounts/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
3 changes: 3 additions & 0 deletions app/views/follower_accounts/index.html.haml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions app/views/following_accounts/index.html.haml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 2510119

Please sign in to comment.