Vaadin Flow (10+) standard page title

Hello,

i want to set a standard page title without defining it in every route class (but for example in the main layout). Is there a simple way to do this? I just could find the following link to define it for a single route class:
[Vaadin Tutorial]
(https://vaadin.com/docs/flow/routing/tutorial-routing-page-titles.html)

Hi,

I found a “workaround” for this:

public class MainLayout extends VerticalLayout implements AfterNavigationObserver, RouterLayout{
	...
	
	@Override
    public void afterNavigation(AfterNavigationEvent event) {
		UI.getCurrent().getPage().setTitle(titleProvider(event)); 
		// titleProvider can be whatever, and may generate the title via event.getLocation() or similar means
    }
}

However, this solution does not seem to work on the initial entering of the application (at least it does not in my case). Also it seems to be more of a hack because it just overrides whatever AbstractNavigationStateRenderer.java is doing in its updatePageTitle method

I found that I can configure the title dynamically by implementing the PageConfigurator on a layout, and adding code as follows:

    @Override
    public void configurePage(InitialPageSettings settings) {
        settings.addInlineWithContents(InitialPageSettings.Position.PREPEND, "<title>Foobar</title>", InitialPageSettings.WrapMode.NONE);
    }