Kevin Ballard <kevin at sb.org> writes:
> 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.
D'oh! Silly me. However:
class Blog
def decorate_title(title_string)
if title_string.blank?
blog_name
else
title_prefix + title_string + title_suffix
end
end
end
module ArticlesHelper
def page_title
if @page_title
h this_blog.decorate_title(@page_title)
elsif @page
h @page.html_title
else
'Typo'
end
end
end
with other stuff implemented pretty much as written in the earlier
post. The main point is to hide the details of *how* we know whether
to append or prepend the blog name. I had an idea last night about how
to package Themes as plugins, which should also make it relatively
simple to add theme specific helper methods a the same time. At least,
it seemed simple until I tried to sketch it here; there's a little
wrinkle that needs a little more thought. I shall get back to you.
--
Piers Cawley <pdcawley at bofh.org.uk>
http://www.bofh.org.uk/