XPages tip: consistent page titles
Something I think is important when launching a web site or any web application for that matter is having consistent page titles. You know, that stuff you keep between <title> tags in your <head> section. It makes it easy to just glance at your open tabs and select the right one, and if you use bookmarks it will in most cases set an appropiate title for your bookmark. So how do you do this easily in XPages? Well, for one, I usually have a custom control called ccDesign or something similar that contains the basic structure of the site. Just add this line to your ccDesign custom control:
<xp:this.beforePageLoad><![CDATA[#{javascript:view.setPageTitle((compositeData.title ? compositeData.title + " - " : "")+@DbTitle())}]]></xp:this.beforePageLoad>
After this you need to add a custom property to your custom control called title, which will just be a string. This will first of all utilize the database title for page title, and if you from your XPage set a page title this will also be included. I don’t know if this is the best approach or anything, it’s just a way that I’ve found that works for me and I’d like to share it. If you have any suggestions or anything, please comment!



Inga kommentarer
Skriv en kommentar i fältet nedan
Lämna en kommentar