Problem using Hugo with baseURL and Netlify forms


I have a website implemented with Hugo and I have noticed today that if I set up the baseURL, either by using the baseURL key in Hugo’s config or by setting up the -b option in the netlify.toml config (as indicated in the docs) then the form processing by Netlify doesn’t work, i.e. the data-netlify="true" and honeypot keywords are still shown in the resulting (deployed) URL and indeed the form looks like it’s submitted but nothing is processed from Netlify.

My contact form is very simple (here is the form tag; and all fields have name tags):

It would be okay for me to leave the baseURL option blank/default (/), but this means that the RSS generated will have relative links (i.e. one cannot open links to the webpage from an RSS reader).

Is this a bug or do I need some extra tweaking in order to use the forms/baseURL correctly?

Thank you in advance!

Hi @jrocha, just as a starting point, have you gone through the steps and tips here: [Support Guide] Form problems, form debugging, 404 when submitting?

Hi @Dennis ! For sure! I spent a good deal of time looking through it and found out that the thing that was breaking the forms’ processing was the baseURL (not saying it’s the root cause, just that overriding the baseURL through any of the ways I described ends up in the forms not getting processed, and the netlify tags will be shown in the resulting HTML).

Maybe it’s still a silly issue on my side, but I resorted to asking for help here after realizing the problem different results expressed above.
If you get to test it, please let me know if you verify that forms can be used when the base URL is being set directly.

Thank you for your help!

I’m not able to reproduce the issue myself. Could you provide a live example of the issue you are seeing? I want to check if there are any errors that can help us narrow down the cause of the issue.

Hey! I have recently found out that the problem I was having happened under the conditions I explained (when having a netlify.toml file) does not happen if I have a method="post" added to the form (turns out I hadn’t and hand’t noticed it).

In case you want to double check whether this is an actual issue (i.e. use a netlify.toml and a form without the method set to it -> doesn’t work, form is not processed; remove the netlify.toml file -> form is processed :man_shrugging:).

1 Like

thanks for explaining! glad to see you have it working now.