What a brilliant feature and I only discovered this the other day so thought I’d post it here in case it helps others to see a real example.
If you want to test your site on other devices on your local network you can use the following:
hugo server -D --bind 192.168.X.Y --baseUrl http://192.168.X.Y
Replace the X & Y with the actual numbers of your host machine’s IP and when your site builds it will be available to your local network on 192.168.X.Y:1313 rather than the usual localhost:1313 which is inaccessible to other machines.
A real time saver if you were having to build on Netlify in order to test your site on say an iPad and/or smart phone.
@codingforfun thanks for the info! I put that in a bash shell for ease-of-use. I’m on MacOS hugo v0.124.1 …
#!/bin/bash
# Set the local IP address to the variable ip
ip=$(ifconfig en0 | grep 'inet ' | grep -v '127.0.0.1' | awk '{print $2}')
# Start hugo
hugo server -D --bind $ip --baseURL http://$ip