[typo] Some basic SEO for typo blogs

Piers Cawley pdcawley at bofh.org.uk
Tue Dec 5 19:39:19 EST 2006


Kevin Ballard <kevin at sb.org> writes:

> Ok, revision 1318 modifies the prefix setting to allow you to postfix
> the page title instead of prefix. Current prefixes will remain
> prefixes, so nobody's blog titles change unexpectedly.

Oi! Not like that it shouldn't. We certainly shouldn't be exposing the
fact that it's implemented as an integer. Here's a suggestion:

class Content
  def html_title
    blog.title_prefix + title + blog.title_suffix
  end
end

class Blog
  def title_prefix
    prepend_blog_name? ? "#{blog_name} : " : ''
  end

  def title_suffix
    append_blog_name? ? " : #{blog_name}" : ''
  end

  def prepend_blog_name?
    title_decoration == 'prepend'
  end

  def append_blog_name?
    title_decoration == 'append'
  end
end

Then the page_title helper simply becomes:

def page_title
  @page.html_title
end

Mmm... fat model/thin controller kicks some serious buttock.

I'm still porting the test suite to rspec or you could expect a patch
to this effect...

-- 
Piers Cawley <pdcawley at bofh.org.uk>
http://www.bofh.org.uk/


More information about the Typo-list mailing list