[typo] Some basic SEO for typo blogs

Kevin Ballard kevin at sb.org
Tue Dec 5 20:33:06 EST 2006


What if we're not looking at a single Content object on the page?  
Like, say, the index? Or search results? Then we don't have a single  
Content object for @page that we can call html_title on.

On Dec 5, 2006, at 7:39 PM, Piers Cawley wrote:

>> 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.

-- 
Kevin Ballard
http://kevin.sb.org
kevin at sb.org
http://www.tildesoft.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/typo-list/attachments/20061205/24a9946e/attachment.html 


More information about the Typo-list mailing list