#static page with param

15 messages · Page 1 of 1 (latest)

ornate gorge
#

im making a search engine, and i want to have /q/urquery
but wanted it to be static, how do i make it dont need to set static path, or make it ssr?

ornate gorge
#

<@&1129102257422610512> help lol

mortal adder
#

If you want this in static, you have to have some kind of static list of search terms

#

Then you need a page that reads the query in JS on the client and queries your entries

#

In SSR you can do that easier in one step

ornate gorge
mortal adder
#

The static list is like a json page

#

You can use fetch to load that in on your actual search page

#

Also you can't do /q/term, because they have to be static paths, but you can do /q?query=term

pliant flame
# ornate gorge oh no way to have astro ignoring the page url after /q/?

You can do that on your deployment. That is outside the scope of Astro.

Astro will generate one page, you can have something like NGINX serve anything starting with /q/ as the same page (look for how to configure an SPA) and then you can make the search on the client side using JS or some UI framework

mortal adder
#

Also possible, but the nginx rewriting might be more difficult to figure out, unless it's vital your links must look like that

#

Otherwise I'd opt for the simpler solution of using the url query

ornate gorge
#

imma do this c: