Prepend all page titles with eSpace or other name

Prepend all page titles with eSpace or other name

  

I would like to have all the Web Screens in my eSpace prepended with my eSpace name, or with some other fixed name. Is there anything built in for doing this?

For example, if my eSpace name is ToolBox and a Web Screen has a specified a title of "Foo Edit", I would like to have it automatically set the title to "ToolBox: Foo Edit". If the Web Screen name is "FooList" and no title is set then OS sends a title of "Foo List" and I'd like it to instead be "ToolBox: Foo List"

I use a common layout and thought I could use the HTTPRequestHandler SetPageTitle Action to do this, but I don't know how to grab the page's Title if one is set, or to grab the OS Web Screen Name based Title when a Title doesn't exist.

What happens if multiple elements on a page call HTTPRequestHandler's SetPageTitle?

Thank you for the ideas,

Jacob

Hi Jacob,

I would say that the last SetPageTitle being called will be the one to set the title, but don't understand when you say multiple elements on a page to call SetPageTitle? This action won't do anything if you're using it with Ajax requests, only works if you're loading the page.

Hi Tiago,

I wasn't sure how it would work. I was hoping it would replace the existing tile because the HTML spec says there should only be one, but after testing with the favicon rel tag I was expecting that the HTTPRequestHandler would just add new ones. I should have just tested.

If I set the Title property on a Web Screen to Screen, this is what is in the head:

<title>
  Screen
</title>

If I call SetPageTitle with Title="ScreenPrep" from that same Web Screen's Preparation, and if I also call SetPageTitle with Title="BlockPrep" from a web block included by that WebScreen (it's my common layout Web Block) then this is what is in the head:

<title>ScreenPrep</title><title>BlockPrep</title>

The page title in IE and Chrome is ScreenPrep, the first title element. I find it interesting that the Web Screen Title propoerty is somehow suppressed or replaced on the output. If it is replaced, I wonder why the second call to SetPageTitle doesn't replace the first call's output.


Either way, what I really want is a way to get the page's page title, set via the Web Screen Title property, the OutSystems' generated value if the Title property is blank, or set via SetPageTitle in the Web Screen preparation and in the common layout web block concatenate that value with a common value like MySiteName + ExistingTitleValue.

Is there a way to get the page's Title property? To get the OutSystems generated Title if one isn't set, or to read and replace the existing title element if one exists?

I haven't found it. I think for now I will just go set the Title property to the desired concatenated value on all of my web screens.