Merge pull request #623 from pozorvlak/seo_crop_detail_page

Add SEO-friendly language to the crop detail page
This commit is contained in:
Taylor Griffin
2015-01-14 22:40:25 +11:00
5 changed files with 59 additions and 19 deletions

View File

@@ -1,4 +1,4 @@
%h4 Find seeds
%h4 Find #{ crop.name } seeds
- if crop.seeds.empty?
%p
There are no seeds available to trade.

View File

@@ -1,4 +1,4 @@
%h4 Harvests
%h4 #{ crop.name.capitalize } harvests
- if crop.harvests.empty?
%p
Nobody has harvested this crop yet.

View File

@@ -1,4 +1,4 @@
%h4 Plantings
%h4 See who's planted #{ crop.name.pluralize }
- if crop.plantings.empty?
%p
Nobody has planted this crop yet.

View File

@@ -13,6 +13,8 @@
.row
.col-md-9
- unless current_member
Learn how to grow #{ @crop.name.pluralize } from growers around the world. #{ ENV['GROWSTUFF_SITE_NAME'] } has tips and advice from real-life growers, including when to plant #{ @crop.name.pluralize }, how to harvest #{ @crop.name.pluralize }, and more.
= render :partial => 'photos', :locals => { :crop => @crop }
@@ -34,37 +36,46 @@
%div#cropmap
%a{:name => 'posts'}
%div.pagination
= page_entries_info @posts, :model => "posts"
= will_paginate @posts, :params => {:anchor => "posts"}
%h2 What people are saying about #{ @crop.name.pluralize }
- unless @posts.empty?
- if @posts.empty?
%p
Nobody has posted about #{ @crop.name.pluralize } yet.
%p
- if can? :create, Post
= link_to "Post something", new_post_path, :class => 'btn btn-default'
- else
= render :partial => "shared/signin_signup", :locals => { :to => "post your tips and experiences growing #{ @crop.name.pluralize }" }
- else
%div.pagination
= page_entries_info @posts, :model => "posts"
= will_paginate @posts, :params => {:anchor => "posts"}
- @posts.each do |post|
= render :partial => "posts/single", :locals => { :post => post, :subject => true }
%div.pagination
= page_entries_info @posts, :model => "posts"
= will_paginate @posts, :params => {:anchor => "posts"}
%div.pagination
= page_entries_info @posts, :model => "posts"
= will_paginate @posts, :params => {:anchor => "posts"}
.col-md-3
= render :partial => 'wrangle', :locals => { :crop => @crop }
= render :partial => 'scientific_names', :locals => { :crop => @crop }
= render :partial => 'alternate_names', :locals => { :crop => @crop }
%h4 Planting advice
%h4 How to grow #{ @crop.name.pluralize }
= render :partial => 'grown_for', :locals => { :crop => @crop }
= render :partial => 'planting_advice', :locals => { :crop => @crop }
%h4 Varieties
= render :partial => 'scientific_names', :locals => { :crop => @crop }
= render :partial => 'alternate_names', :locals => { :crop => @crop }
%h4 #{ @crop.name.capitalize } varieties
= render :partial => 'varieties', :locals => { :crop => @crop }
%h4 More information
%ul
%li= link_to 'Wikipedia (English)', @crop.en_wikipedia_url
= render :partial => 'plantings', :locals => { :crop => @crop }
= render :partial => 'harvests', :locals => { :crop => @crop }
= render :partial => 'find_seeds', :locals => { :crop => @crop }
%h4 Learn more about #{ @crop.name.pluralize }
%ul
%li= link_to 'Wikipedia (English)', @crop.en_wikipedia_url

View File

@@ -28,5 +28,34 @@ feature "crop detail page" do
end
end
context "SEO" do
background do
visit crop_path(crop)
end
scenario "has seed heading with SEO" do
expect(page).to have_content "Find #{ crop.name } seeds"
end
scenario "has harvest heading with SEO" do
expect(page).to have_content "#{ crop.name.capitalize } harvests"
end
scenario "has planting heading with SEO" do
expect(page).to have_content "See who's planted #{ crop.name.pluralize }"
end
scenario "has planting advice with SEO" do
expect(page).to have_content "How to grow #{ crop.name }"
end
scenario "has a link to Wikipedia with SEO" do
expect(page).to have_content "Learn more about #{ crop.name }"
expect(page).to have_link "Wikipedia (English)", crop.en_wikipedia_url
end
end
end
end