Permalink
Browse files

Remove parent page's heading from title tag.

See #108 if you're interested in reasons why this makes sense. To be
fair, specific titles (as supported by this commit) are better for your
users, and better for your SEO (should you care). If you want longer
titles with more contextual info in, you can still set the 'Title'
metadata on each page.
  • Loading branch information...
1 parent db3142b commit c8dd1d3a7c16a4079d08886e634bb02281f04df1 @gma gma committed Apr 25, 2012
Showing with 4 additions and 12 deletions.
  1. +1 −3 lib/nesta/models.rb
  2. +2 −2 spec/models_spec.rb
  3. +1 −7 spec/page_spec.rb
View
@@ -221,10 +221,8 @@ def heading
def title
if metadata('title')
metadata('title')
- elsif parent && (! parent.heading.nil?)
- "#{heading} - #{parent.heading}"
elsif heading
- "#{heading} - #{Nesta::Config.title}"
+ heading
elsif abspath == '/'
Nesta::Config.title
end
View
@@ -77,9 +77,9 @@ def create_page(options)
end
describe "for home page" do
- it "should set title to heading and site title" do
+ it "should set title to heading" do
create_page(:heading => 'Home', :path => 'index')
- Nesta::Page.find_by_path('/').title.should == 'Home - My blog'
+ Nesta::Page.find_by_path('/').title.should == 'Home'
end
it "should respect title metadata" do
View
@@ -213,7 +213,7 @@ def do_get
it "should use heading for title tag" do
do_get
- body.should have_tag('title', 'My article - My blog')
+ body.should have_tag('title', 'My article')
end
it "should display the date" do
@@ -256,12 +256,6 @@ def do_get
body.should have_tag(
"nav.breadcrumb/a[@href=#{@category.abspath}]", @category.heading)
end
-
- it "should contain category name in page title" do
- do_get
- body.should_not have_tag("title", /My blog/)
- body.should have_tag("title", /- #{@category.heading}$/)
- end
end
end

0 comments on commit c8dd1d3

Please sign in to comment.