AppLayout with footer

I’m using an AppLayout with a couple of views. I want to add a footer to all views with some links to imprint etc.
I did as @knoobie suggested and overwrote the setContent() method in my layout class:

    public void setContent(Component content) {
        loContent.removeAll();
        loContent.addAndExpand(content);
        loContent.add(loFooter);
        super.setContent(loContent);
    }

(loContent is a VerticalLayout)

This works fine in general, but now the page title always says “VerticalLayout”. I assume that is because this component doesn’t have a PageTitle annotation.
How can I “pass through” the page title of the views here?

Sorry, nevermind, found it: I had to adjust the place where I call MenuConfiguration.getPageHeader().

Another way to achieve that is to use a view-wrapper route-layout in between your AppLayout (assuming that’s your root layout), like so:

@Layout
@ParentLayout(MainLayout.class)
public class ViewWrapper extends VerticalLayout implements RouterLayout {

    Div contentWrapper = new Div();

    public ViewWrapper() {
        setHeightFull();
        setPadding(false);
        setSpacing(false);

        contentWrapper.setSizeFull();
        addAndExpand(contentWrapper);

        var footer = new Footer(new Span("Footer"));
        footer.setWidthFull();
        add(footer);
    }

    @Override
    public void showRouterLayoutContent(HasElement content) {
        if (content != null) {
            contentWrapper.getElement().insertChild(0, new Element[]{(Element) Objects.requireNonNull(content.getElement())});
        }
    }

OK, so here it’s a Div instead of VerticalLayout and you use showRouterLayoutContent instead of setContent, but the idea is basically the same, right?
Is there any advantage to do this in an extra Layout class?

Probably doesn’t make much difference from a technical PoV, but if you have elements you want to include on each view (that AppLayout doesn’t provide a place for), it feels conceptually cleaner to me to define an intermediate layout that handles them.

It also feels cleaner since you’re not unnecessarily removing and re-adding those shared elements that never change between views anyway. In this particular case, where it’s just a footer that’s probably extremely lightweight, that hardly matters, but if it were something heavier, it might.

OK, thanks. I suppose it’s just a matter of personal preferences then. :)