Skip to content

Commit

Permalink
Do not show site title when it's empty. closes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
kpumuk committed Mar 3, 2012
1 parent 0eb9255 commit 703900a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/meta_tags/view_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def build_full_title(meta_tags)
if title.blank?
meta_tags[:site]
else
title = normalize_title(title).unshift(h(meta_tags[:site]))
title = normalize_title(title)
title.unshift(h(meta_tags[:site])) unless meta_tags[:site].blank?
title.reverse! if meta_tags[:reverse] === true
sep = h(prefix) + h(separator) + h(suffix)
title = title.join(sep)
Expand Down
5 changes: 5 additions & 0 deletions spec/meta_tags_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@
subject.display_meta_tags(:site => 'someSite').should == '<title>someSite | someTitle</title>'
end

it 'should display title only when "site" is empty' do
subject.title('someTitle')
subject.display_meta_tags.should == '<title>someTitle</title>'
end

it 'should display title when "set_meta_tags" used' do
subject.set_meta_tags(:title => 'someTitle')
subject.display_meta_tags(:site => 'someSite').should == '<title>someSite | someTitle</title>'
Expand Down

0 comments on commit 703900a

Please sign in to comment.