I’ve read and followed this tutorial to deploy automatically a Hugo site on a server after a git push.
When I run
hugo server command in my local directory, the site render perfectly but when I check on the production server, there’s some files missing … the console output give this :
Why on the local server it’s working great ? The compilation is meant to work too if there’s no error when launching server
Have you set the correct baseURL? That is a common mistake.
Yes, the baseURL is set with the domain server address.
The terminal output says there are 5 English pages produced and 4 French. How many do you expect?
Are you running the same version of Hugo in development and production?
The warnings are interesting? Do they show up in your development environment? Is your theme/layouts properly configured?
Problem 1: I don’t see in your post-receive hook anything that implies that your theme is checked out. If you use your own theme inside of the layouts folder then read on, if you are using a theme in the themes folder that you use via submodule have a look at the checked out files and verify that you don’t have your theme there. If so, your receive hook probably needs another command that checks out submodules or loads the theme however it is put into your repo.
Problem 2: @bep somewhere wrote something about parallel creation of pages. What I see from your output warnings is that you have no standard templates for pages, home and taxonomyTerms. Because the production is running in parallel on your local station it probably thinks it’s a package page and creates the files anyway. On the live server you might not have the same amount of processing capabilities and that leads to those pages missing.
My guess is it’s door number 1.
Indeed, the checkout of
themes folder was missing in the
I added a line to clone the theme from GitHub after the clone of my blog repository and the build was successfully done.
I don’t know if it’s the right way but this way can always get the last version of the theme so I think it’s cool.
Edit: or simpler, add the
--recurse-submodules param to the
git clone command in the
post-receive script if the theme is a submodule.