You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@roller.apache.org by Matt Raible <mr...@gmail.com> on 2006/06/18 00:08:04 UTC
Printing Title for main page, but different for sub-pages
Currently, I have the following system working where the title of my
last post is added to the title.
#set( $xmap = $pageModel.getRecentWeblogEntries(1,'nil') )
#foreach( $day in $xmap.keySet() )
#set( $recentEntries = $xmap.get($day) )
#foreach ($var in $recentEntries)
#set ($title = $var.title)
#end
#end
<title>#showWebsiteTitle() | #if ($page.Name == "Weblog") $title
#else $page.Name #end</title>
However, I'd like to enhance it so $title is only shown when someone
is viewing a single post, or paging through multiple posts. In other
works, when people are viewing the default page (or All category), the
same title is used. I tried the following (looking for null
requestParameters), but it doesn't seem to work.
Any ideas on how to detect the default page is rendered for a blog?
#set( $xmap = $pageModel.getRecentWeblogEntries(1,'nil') )
#foreach( $day in $xmap.keySet() )
#set( $recentEntries = $xmap.get($day) )
#foreach ($var in $recentEntries)
#set ($title = $var.title)
#end
#end
<title>#showWebsiteTitle() | #if (!$requestParameters &&
$page.Name == "Weblog") Open Source Development Tips by Matt Raible
#elseif ($page.Name == "Weblog") $title #else $page.Name #end</title>
Thanks,
Matt
Re: Printing Title for main page, but different for sub-pages
Posted by Matt Raible <mr...@gmail.com>.
Nevermind, figured it out. Here's what I ended up using:
#set( $xmap = $pageModel.getRecentWeblogEntries(1,'nil') )
#foreach( $day in $xmap.keySet() )
#set( $recentEntries = $xmap.get($day) )
#foreach ($var in $recentEntries)
#set ($title = $var.title)
#end
#end
<title>#showWebsiteTitle() | #if ($requestParameters.isEmpty() &&
$page.Name == "Weblog") Matt Raible's discussions on Java and Web
Development #elseif ($req.getParameter($WEBLOGCATEGORYNAME_KEY) &&
$page.Name == "Weblog")
$req.getParameter($WEBLOGCATEGORYNAME_KEY).substring(1) Category
#elseif ($page.Name == "Weblog") $title #else $page.Name #end</title>
On 6/17/06, Matt Raible <mr...@gmail.com> wrote:
> Currently, I have the following system working where the title of my
> last post is added to the title.
>
> #set( $xmap = $pageModel.getRecentWeblogEntries(1,'nil') )
> #foreach( $day in $xmap.keySet() )
> #set( $recentEntries = $xmap.get($day) )
> #foreach ($var in $recentEntries)
> #set ($title = $var.title)
> #end
> #end
> <title>#showWebsiteTitle() | #if ($page.Name == "Weblog") $title
> #else $page.Name #end</title>
>
> However, I'd like to enhance it so $title is only shown when someone
> is viewing a single post, or paging through multiple posts. In other
> works, when people are viewing the default page (or All category), the
> same title is used. I tried the following (looking for null
> requestParameters), but it doesn't seem to work.
>
> Any ideas on how to detect the default page is rendered for a blog?
>
> #set( $xmap = $pageModel.getRecentWeblogEntries(1,'nil') )
> #foreach( $day in $xmap.keySet() )
> #set( $recentEntries = $xmap.get($day) )
> #foreach ($var in $recentEntries)
> #set ($title = $var.title)
> #end
> #end
> <title>#showWebsiteTitle() | #if (!$requestParameters &&
> $page.Name == "Weblog") Open Source Development Tips by Matt Raible
> #elseif ($page.Name == "Weblog") $title #else $page.Name #end</title>
>
> Thanks,
>
> Matt
>