Site preview from smart phone in LAN is not possible

I build my site on my laptop and try to preview the layout from mobile phone in LAN.
My laptop and my mobile phone are all connected to the router via wifi

hugo --buildDrafts server

shows

Web Server is available at http://localhost:1313/

My IP address for laptop is 192.168.1.37

So I try to type 192.168.1.37:1313 in Chrome of my Nexus 5.

However, it does not work:

This site can't be readched

192.168.1.37 refused to connect

I am pretty sure it is the problem of hugo server, since I tried jekyll and other server programs with my smart phone and pad, they all work as normal.
It seems the hugo server refuse the connection other than localhost …

Any ideas ?

Try

hugo server -D --bind 192.168.1.37

Thank you for the quick reply.
I works, but not css file is loaded and all links are broken, since they start with localhost:1313/...
I think css file problem is also cause by URL.
Is there a workaround ?

hugo server -D --bind 192.168.1.37 --baseURL http://192.168.1.37
``

try `hugo server -h` for more options.
3 Likes

It works! Thank you.

You got it sorted in the end. But, just in case anyone else is developing for mobile as well:

Both Firefox and Chrome’s Web Developer tools now include mobile device simulators to help with this kind of thing.

In Firefox the button is called ‘Responsive Mode’…

and in Chrome ‘Device Mode’…

Both allow you to test your layout on a range of common mobile device screen sizes, without needing the actual hardware to hand:

Firefox Version:

Chrome version

2 Likes

Thank you for your advice.
It’s nice to know. =)

Wow very cool, was just wondering about this the other day! Thanks for sharing.