Theme variable base_url_simple


I am making a theme. I need to collect in a twig template the web path without the language code. Reading the official documentation I see that the variable to use is base_url_simple, but it doesn’t create any value.

The {{ base_url_simple }} returns the base URL to the Grav site, without the language code.

Am I doing something wrong? Have I misunderstood something?

Thanks for your time


If the url to your home page is https://domain/path/to/home, base_url_simple will return /path/to/home.

Thanks to reply, @pamtbaau

In my case, this variable returns me an empty value. All variables work fine except this. I’ve testing everyone on the same line of code to learn exactly what value each of them returns, so I rule out a typing error on my part.

Grav v1.7.30 - Admin v1.10.30.2


In my case

Unfortunately, you haven’t shared the url to you home page, so we cannot check if base-url_simple returns a faulty value.

If your home page is https://domain/ then base_url_simple should indeed by empty.

1 Like

Ok, so I definitely misunderstood the documentation (I support my english knowledge with a translator) The variable I was looking for is {{ uri.base }}.

Thanks @pamtbaau

@sdesergi, Misunderstandings happen…

Next time, when asking a question, you might consider to share:

  • What you are trying to achieve.
  • What the result should look like.
  • What you have tried.
  • What the result is you’re seeing.