Non-Production Build URLs

I've been using pages to host Hugo sites, but am looking into workers for a new site. In my Pages site, I was using a bash script to build differently for "main" versus "staging", and Pages handled automatically mapping the <branch-name>.pages-name.pages.dev URL for preview builds on branches other than main. If i'm reading the docs correctly, Workers is supposed to also automate preview URLs, but i'm seeing non-main branches trigger changes to the <worker>.<user-name>.workers.dev URL same as a check-in to main. What am I missing? Sidenote: I've also tried following this: https://developers.cloudflare.com/workers/wrangler/environments/#staging-environment-with-workersdev and added npx wrangler deploy --env staging as my preview deploy command. wrangler.jsonc: { "name": "project-name", "compatibility_date":"2025-05-28", "assets": { "directory": "./public" }, "env": { "staging": { "workers_dev": true } } } Message #workers-and-pages-discussions
Cloudflare Docs
Environments
Use environments to create different configurations for the same Worker application.
1 Reply
LordNikon
LordNikon6mo ago
I too am looking for how to do this correctly with Hugo.

Did you find this page helpful?