On a (Windows) PC, should NavBar #Links work in a 'production' site?

I have a site (‘Academic’ theme) happily working via the ‘localhost’ hugo server.

I use the ‘hugo’ command to export it to a ‘real’ (HTML/CSS) site, in the ‘public’ folder.

I open this site, in my web browser. But the stylesheet isn’t found. Poking around, I find that if I remove the initial backslash from the filename, the stylesheet does get found. I then discover “relativeurls=true” which seems to solve this problem properly.

However, a second problem remains: the ‘#’ options on my NavBar menu (the ones that position up and down index.html) don’t work on the PC ‘production’ site. Not surprising, because if I “mouseover” them they’re eg:

file:///C:/hugo_dir/projectname/public/#link1

and sure enough, looking at the generated HTML, it’s because the link address is

“./#link1

I’ve experimented like crazy with every combination of the baseurl, relativeurls and uglyurls settings, but no joy.

So: does the NavBar/Menu normally work for people, in PC/Windows/Production, or has anyone made it work? (I’m guessing this issue is likeliest to do with Hugo, rather than my template, but apologies if I’m wrong.)

Please share tour site project (create one to share if you need), and we can figure this out. You’ll just need to match your config to how the link is produced in the theme.

You can also check the Academic thene support channel and issue queue as well. :slight_smile:

Thanks, Maiki – actually (I should’ve thought of this, doh!), I just tried the Academic theme’s own “example site” - I made a ‘production’ version of the example site, on my PC hard disk, and opened this ‘production’ version in a browser - and it has the exact same problems, with stylesheet and menu.

To check: I finally (at the third attempt) found a different Hugo theme that I could successfully install - called ‘Zzo’ and by someone different to ‘Academic’ and looking very different - and it too had the exact same problems.

So maybe it is a Hugo thing?

Has no-one, on a Windows-PC, ever tried opening a Hugo “Production” build in their browser, ever? (Is it just me, wanting to put a working copy on someone else’s hard disk?)

Can’t see anything on Github/Issues about this… think I should report it?

We can’t assist unless we can reproduce the error; in this case that means you should create a repo, document the error you are having (copy and paste the errors, or share screenshots), and share the repo. Then we can attempt to debug or reproduce.

Hi - well, I think I’ve worked this out (using ‘Academic’ theme and its ‘exampleSite’ content):

– you just CANNOT open your “production build” on the PC. The menu links are just not going to work, as they rely on things that web browsers do on the web, like “automatically assuming an ‘index.html’ in a link”.

– But your site WILL work online, and FROM ANY FOLDER you put it in, if you say:

relativeurls = true

and

baseurl = “/”

(and ps, do not try

uglyurls = true

because if you do, any menu links that involve folders will no longer work, even on the web.)