Join the Webstudio community

Updated last month

using URL query params from the slug to use in requests

At a glance

The community member has a URL that is supposed to pull data from a Cloudflare worker to get captions from a YouTube video. The URL works in WebStudio but not when published, resulting in an "Invalid video ID format" error. The community member believes this is because WebStudio is stripping the URL parameter. They want to pull the data server-side to assist with SEO.

In the comments, another community member suggests using search instead of parameters, but notes that this method cannot be tested in WebStudio. They also agree that the URL bar should be available on all pages, not just those with dynamic paths, and that there should be a way to input queries.

There is no explicitly marked answer in the post or comments.

Useful resources
I have a url https://shieldcoat.wstd.io/university/shieldcoat-quick-dry-roof-coating-how-long-between-coats?v=oJFYhoSwskg

I have a collection that is supposed to pull data from a cloudflare worker I have that strips the v=oJFYhoSwskg to get captions from the id on youtube then return the captions as json so I can add it to my page.

When I use shieldcoat-quick-dry-roof-coating-how-long-between-coats?v=oJFYhoSwskg on the dyanmic slug inside of webstudio it works but when I publish it doesnt work and I get an error on my worker

message:

"Invalid video ID format",
$workers:

{
event:

{
request:

{
url:

"https://youtube-captions.adrian-b0e.workers.dev/does-shieldcoat-thermabond-really-reduce-heat-scientific-proof-of-25-30-energy-savings",
method:

"POST",
path:

"/does-shieldcoat-thermabond-really-reduce-heat-scientific-proof-of-25-30-energy-savings"
}
},

this implies that even though my webpage has the url param webstudio doesnt have that path and it is stripping the url param. Is this correct?

Ideally I want this to be pull server side so that it assists with SEO, I know I can correct this with a client side script.
a
O
2 comments
I figured out I needed to use search for this not params however you cant test inside of webstudio with this method there should be a UI where you can put search fields.
Agree, @Bogdan and I discussed this https://github.com/webstudio-is/webstudio/issues/5127

We need to make this URL Bar available on any pages, not only the once with dynamic path and it should also have query input

As a workaround you can create any link with a query and click it in preview
Add a reply
Sign up and join the conversation on Discord