# StoryBlogTitle.rb # # If you are viewing a story directly, we add the entries title # to args['blog_title'], overriding config['blog_title'] in the # BlosxonomyRenderer. If you're searching for a tag, it reads # Tag: at $site_title # # Your original $blog_title will be accessibe as $site_title def cb_prepare( args ) config = args['config'] pathinfo = args['PATH_INFO'] args['site_title'] = args['blog_title'] return if not pathinfo r = Regexp::compile( '^' + config['item_path'] ) if r.match( pathinfo ) entries = args['entries'] return if entries.length != 1 args['blog_title'] = entries[0]['title'] else r = Regexp::compile( '^' + config['tags_path'] + "/(.*)" ) m = r.match( pathinfo ) if m tagstring = m[1] tagstring = tagstring.gsub( '+', ' or ' ) tagstring = tagstring.gsub( '/', ' and ' ) args['blog_title'] = "Tag" args['blog_title'] += 's' if /[+\/]/.match( m[1] ) args['blog_title'] += ': ' + tagstring end end end