Forum: Typo titles for tagged pages

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ernie O. (Guest)
on 2006-04-01 23:07
(Received via mailing list)
This is probably a quickie.  I'd like to see pages that are tag links,
such
as http://www.website.com/blog/articles/tag/blah have a title of "
Website.com - Blah", where currently the title is only set to
"Website.com".
How can I set that?  More importantly so that it's not overwritten each
time
I svn update. ;-) The reason for this is that most page tracking
systems,
like Mint, will key on the page titles when aggregating the data, so
tagged
pages do not count any diffferently than the front page.
Trejkaz (Guest)
on 2006-04-02 03:55
(Received via mailing list)
On Sunday 02 April 2006 05:05, Ernie O. wrote:
> This is probably a quickie.  I'd like to see pages that are tag links, such
> as http://www.website.com/blog/articles/tag/blah have a title of "
> Website.com - Blah", where currently the title is only set to
> "Website.com". How can I set that?

Inside the tag method of articles_controller.rb, you probably want to
assign
@page_title to the title you want.

> More importantly so that it's not overwritten each time I svn update. ;-)

This is probably pointing out the obvious, but when you make changes to
any
files in a SVN repository, those changes are preserved when you svn
update.

TX
Ernie O. (Guest)
on 2006-04-02 07:14
(Received via mailing list)
I found this in app/helpers/articles_helper.rb

def page_title
    if @page_title
      @page_title
    else
      this_blog.blog_name || "Typo"
    end
end

I'm trying to add something like
    + " - #{tag.display_name}"
somewhere but I can't seem to find where and how.
Kevin B. (Guest)
on 2006-04-02 07:29
(Received via mailing list)
You might try doing exactly what Trejkaz suggested. In app/
controllers/articles_controller.rb, look for the method you want to
override the title for and set @page_title there.
Ernie O. (Guest)
on 2006-04-02 09:24
(Received via mailing list)
I found this in app/controllers/articles_controller.rb as the only
mention
of @page_title or tags.

  def tag
    render_grouping(Tag)
  end
  def view_page
    if(@page = Page.find_by_name(params[:name].to_a.join('/')))
      @page_title = @page.title
    else
      render :nothing => true, :status => 404
    end
  end

and setting the @page_title line to
         @page_title = @page.title + " - #{tag.display_name}"
doesn't produce anything when the URL is
    http://www.website.com/blog/articles/tag/blah

The text I'm trying to add to the title is dynamic based on the tag if
the
path includes "articles/tag", so it's not a predefined text I'm setting.
In
fact it should probably work that way for categories, too.

I'll keep digging to see how this all works with articles_controller.rb
Complete newb here, if you haven't noticed. =)
Trejkaz (Guest)
on 2006-04-02 13:02
(Received via mailing list)
On Sunday 02 April 2006 15:23, Ernie O. wrote:
>       render :nothing => true, :status => 404
>     end
>   end
>
> and setting the @page_title line to
>          @page_title = @page.title + " - #{tag.display_name}"
> doesn't produce anything when the URL is
>     http://www.website.com/blog/articles/tag/blah

I think you might be getting a bit confused here.  You want to set the
title
in the "tag" method, not the "view_page" method.  It's the tag pages
which
you want to have the title, right?

TX
Scott L. (Guest)
on 2006-04-03 17:52
(Received via mailing list)
One thing to remember--the search engine optimization people
generally*discourage* putting your site name in the <title>
ofpages--apparently it causes a noticable drop in search
engineperformance.

Scott
Ernie O. (Guest)
on 2006-04-03 22:53
(Received via mailing list)
Yes, you have it right, Trejkaz.  I think I see the light now.
Thanks for your pointer about the site name, Scott.
Trejkaz (Guest)
on 2006-04-04 01:37
(Received via mailing list)
On Monday 03 April 2006 23:50, Scott L. wrote:
> One thing to remember--the search engine optimization people
> generally*discourage* putting your site name in the <title>
> ofpages--apparently it causes a noticable drop in search engineperformance.

Now that's interesting.  Those same people used to tell you to put it in
there
because it raised performance.  Let me guess -- every spam site on the
internet then did it, and thus the odds of a real site doing it fell
dramatically, and we ended up back at step 1.

In any case, should Typo remove the site name from all the titles? :-)

TX
Ernie O. (Guest)
on 2006-07-04 07:52
(Received via mailing list)
Finally got around to posting this one-liner as a patch in Trac:
http://www.typosphere.org/trac/ticket/958

This lets systems like Mint identify when people visit category or tag
groupings which would otherwise show as the blog name, the same as the
front
page would.  This might be good for other places like pagination and
archive
pages.
This topic is locked and can not be replied to.