Skip to content

Commit 99478b4

Browse files
committed
Add Twitter Card markup to the 'Show Job' pages
1 parent 5f7397d commit 99478b4

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

app/controllers/teams_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ def show
5151
@team.viewed_by(viewing_user || session_id) unless is_admin?
5252
@job = show_params[:job_id].nil? ? @team.jobs.sample : Opportunity.with_public_id(show_params[:job_id])
5353
@other_jobs = @team.jobs.reject { |job| job.id == @job.id } unless @job.nil?
54+
@job_page = show_params[:job_id].present?
5455
return render(:premium) if show_premium_page?
5556
end
5657
format.json do

app/views/teams/premium.html.haml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
- if ENV['ENABLE_TWITTER_CARDS']
22
- meta twitter: {card: "summary"}
33
- meta twitter: {site: "@coderwall"}
4-
- meta twitter: {title: sanitize(@team.name)}
5-
- meta twitter: {url: teamname_path(@team.slug)}
6-
- meta twitter: {description: @team.about}
74
- meta twitter: {image: @team.avatar_url}
85
- meta twitter: {creator: {id: @team.twitter}}
6+
- if @job_page
7+
- meta twitter: {title: sanitize(@job.title)}
8+
- meta twitter: {url: job_path(@team, @job.public_id)}
9+
- meta twitter: {description: @job.description}
10+
- else
11+
- meta twitter: {title: sanitize(@team.name)}
12+
- meta twitter: {url: teamname_path(@team.slug)}
13+
- meta twitter: {description: @team.about}
914

1015
-content_for :head do
1116
=stylesheet_link_tag 'premium-teams'

0 commit comments

Comments
 (0)