Support Forums

Use $URL in master branch, otherwise $DEPLOY_URL in Build command

My build command looks like

hugo -b $DEPLOY_URL

But the problem is that master is a release branch so production ends up having silly URLs like https://5b243e66dd6a547b4fee73ae--petsof.netlify.app instead of https://www.petsofnetlify.com

If I use hugo -b $URL, then other branches are broken.

How do I fix this?

I’m sorry, I’m having a little trouble understanding your question.

However, I think, you’re trying to supply a different build command for the release branch and other branch deploys. If yes, you can do so like this:

In your netlify.toml, add the following:

  command = hugo -b $DEPLOY_URL

  command = hugo -b $URL

Yes. Thanks. That’s what I am looking for.