The "Hugo" command does not produce working links

When I run hugo server in my project. I get a working site.

I can even click the links

However, when I run hugo to produce a public folder. I try to access a link and I get this window:

(Note: I was trying to access the link from the site’s index.)

How can I resolve this?