These are rough notes from whatever I was working on, interested in or thinking about at the time. They vary greatly in quality and length, but prove useful to me, and hopefully to you too!
Bind hugo to localhost for development
Situation: Want to run hugo on my laptop and access the website from my phone over wifi so that I can debug an issue that only occurs on my phone (issue does not occur in responsive mode using developer tools).
By default hugo binds to
localhost which is only accessible internally (e.g. from on the same computer). Typically binding to
0.0.0.0 will allow a server to be accessed externally (e.g. from another computer on the same network). However, just doing:
Does not completely work. Hugo will still use
localhost to try and load resources (e.g. images, stylesheets).
The workaround is to use the
--baseURL option, however unfortunately
<IP> needs to be the IP address of your current machine (can’t just use
0.0.0.0) so the solution is not portable:
hugo --bind=0.0.0.0 --baseURL=http://<IP>:1313