How to use |app in Multisite app

Hello !
I am on a new project based on October v3.4.5 and an old template (from V2), localised via Multisite and I don’t know how to find documentation about the {{ ‘/’|app }} behavior.
Before, this Twig filter gave something like http://localhost/en and now, only http://localhost, even if the multisite en is used.
I tried a lot of settings, these are the lasts, but… does not work.

Thanks a lot for your help!

This is a good point. There may need to be an approach to linking in the context of the active site.

Hi @Olivier

We’ve looked at this and using |app for the site context would break many things since it is often used to reference assets in the context of the app.

For this you could use {{ }}. Or if you can provide an example of why you need this, we could take another look.

Hi @daft !

While trying to find a native solution I added a Twig filter in my plugin, it does the job.

Note that surprisingly config(‘app.url’) seems dynamic (contains the current locale path) and equal to {{ }}.

public function registerMarkupTags(): array
        return [
            'filters' => [
                'site' => [$this, 'site']
            'functions' => [
                // ...Functions defined here

    public function site($string): string
        return config('app.url') . $this->checkSlash($string);
    public function checkSlash($string): string
        return (str_starts_with($string, '/')) ? $string : '/' . $string;
1 Like

Look great! I’m just curious why not use |page for this?

I apply this filter on urls containing anchors. On the other hand, I don’t think I ever use |page in any of my projects.