Re: Markup inheritance with child pages setting title in the form 'BasePage.title + - + ChildPage.title'

2009-04-16 Thread Janos Cserep
 1. Set an instance variable in the base page called basePageName


You don't need a variable - all you need is a getter:

public IModelString getPageTitleModel() {
  return new Model(ApplicationName);
}


 2. Use a Label to set the title in the base page


Exactly, like this:

add(new Label(pageTitle, getPageTitleModel());



 3. Let child pages append their part to the Label


public IModelString getPageTitleModel() {
  return new Model(ApplicationName - Cool Page);
}


Another approach (this way you handle localization and don't have to
override anything in your pages):

public IModelString getPageTitleModel() {
  return new StringResourceModel(this.getClass().getSimpleName() +
.PageTitle, this, null);
}

and put

CoolPage.PageTitle=ApplicationName - Cool Page Title

into your application properties file.


Re: Markup inheritance with child pages setting title in the form 'BasePage.title + - + ChildPage.title'

2009-04-16 Thread Cserep Janos
 CoolPage.PageTitle=ApplicationName - Cool Page Title

 into your application properties file.



From an SEO point of view this approach is more versatile. I usually have

CoolPage.PageTitle
CoolPage.MetaDescription
CoolPage.MetaKeywords

all defined in properties files and added from base page. If you put your
domain object into the page's model (if I have a ContentView page I usually
put a DetachableContentModel into the page's default model) you can even
have these string properties reference properties from that object if you
pass the page's model to the StringResourceModel like this:

public IModelString getPageTitleModel() {
  return new StringResourceModel(ApplicationName, this,
getDefaultModel());
}


Markup inheritance with child pages setting title in the form 'BasePage.title + - + ChildPage.title'

2009-04-16 Thread Kent Larsson
Hi,

I use markup inheritance and this example was quite informative
http://wicket.apache.org/examplemarkupinheritance.html .

One thing I find missing is how to set the title from the child pages?

Ideally I would like page titles like:

ApplicationName - Cool part of the application
ApplicationName - Part of the application
ApplicationName - Some other part of the application

It seems like the part 'ApplicationName -' could be set by the base
page and the rest of the string could be appended by the child page.

I have one idea on how to do it:

1. Set an instance variable in the base page called basePageName
2. Use a Label to set the title in the base page
3. Let child pages append their part to the Label

Of course by using some nice methods which are overridden.

Is there a better way to do it?

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: Markup inheritance with child pages setting title in the form 'BasePage.title + - + ChildPage.title'

2009-04-16 Thread Kent Larsson
Thank you both! :-) I'll do it that way and use resources.

/ Kent


On Thu, Apr 16, 2009 at 12:50 PM, Cserep Janos cser...@szeretgom.hu wrote:
 CoolPage.PageTitle=ApplicationName - Cool Page Title

 into your application properties file.



 From an SEO point of view this approach is more versatile. I usually have

 CoolPage.PageTitle
 CoolPage.MetaDescription
 CoolPage.MetaKeywords

 all defined in properties files and added from base page. If you put your
 domain object into the page's model (if I have a ContentView page I usually
 put a DetachableContentModel into the page's default model) you can even
 have these string properties reference properties from that object if you
 pass the page's model to the StringResourceModel like this:

 public IModelString getPageTitleModel() {
  return new StringResourceModel(ApplicationName, this,
 getDefaultModel());
 }


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org