Is uri.query() not working on static pages without php?


I use the theme variable uri.query to add params from current url to an form url string. On local development environment everything works fine.

{% set uriParams = uri.query != '' ? '&' ~ uri.query %}
{% set form_url = button.link_extern ~ h2Params ~ lpidParam ~ uriParams %}

On the static exported live site on server without php uri.query does’nt give any params.
Is php required for this function?

The theme variable uri.route works on both systems.

I’m looking forward to an answer!

I thought PHP is requierd for Grav to work at all :confused:

@Karmalakas for working with admin panel e.g. you need php. But you can provide an static exported website to your visitors on another server for example.
There are several plugins you can use to generate a static export like blackhole.

We use this way to have a high security level.

Oh I see :slight_smile: My guess…

uri.route is taken from Grav core where it parses page structure and frontmatter of each page to get slugs and what not. uri.query most likely taken from GLOBALS (probably $_REQUEST), so that might be the reason it’s empty on export. Query I guess is something you entered in some filter field or so and exporter definitely wouldn’t export such pages.

Ok. So uri.query() is based on php. I used it to get query params of current page url in twig template and added them to a string. Then I have to do it in another way…perhaps javascript.

Yep, every Grav internal is PHP. uri.query() renders server-side, but it’s easy to replace in JavaScript. An example in Scholar.


JavaScript to get all query params as string:

urlParams = new URLSearchParams(;
urlParamsString =  urlParams.toString();