Had the same issue, and appear that I cannot be used with output: "static"
and for now Astro@5 we can only use output: "server"
and this fixed the issue but ofc we need to handle different deployment by that.
used this solution
---
const initialTag = Astro.url.searchParams.get("tag") || "";
---
tried to fix it to work with output: "static"
and marking the page as not prerendered:
---
...
export const prerender = false;
---
but after build it appear - it doesn't work