Hugo: navigateToChanged ignores subfolder url path in baseURL

Created on 10 Jul 2017  路  14Comments  路  Source: gohugoio/hugo

There is a little problem with ( --navigateToChanged ) if your website is running in a subfolder ...

hugo.exe server --watch=true --verbose --bind="127.0.0.1" --port=80 --config="config.toml" --baseURL="http://127.0.0.1/report/" --navigateToChanged

--navigateToChanged ignores the /report/ part of the baseURL and navigates to wrong url which is missing that url part while debug editing

Enhancement Keep

Most helpful comment

I hate my nickname :rofl:

All 14 comments

Why do you need to run with subfolder when on localhost?

The final site is deployed in a subfolder on the domain.

When I started the project I 1:1 used the settings but replaced the domain name with localhost.

If this is nasty to fix ... okay

I just used my project settings with the param and it didn't work.

So I'd understand that as a bug as cmdline param should work with all allowed && valid settings, right ?

But I will change my debug settings according to your advise with sounds reasonable.

I hate my nickname :rofl:

the @nick symbol was added by accident while updating the comment, sorry about that ... I'd consider to change your nick @nasty

So I'd understand that as a bug as cmdline param should work with all allowed && valid settings, right ?

Well, it is a bug (I assumed it should just work) -- but it has a cost to fix it, so I wanted to get the priority right ...

Please set it on a low priority as there is a workaround, thanks for your help @bep !

Strangely enough, I can't reproduce this with Hugo v0.25 on my Debian GNU/Linux (Debian 9 Stretch) on amd64, i.e. --navigateToChanged works perfectly fine with subfolder URL path in baseURL!

Could this be a Windows-only issue? I will investigate, eventually. (Too busy this week.)

But yes, if a macOS user could do the same test to see if it is reproducible, that would be wonderful!
Many thanks!

@anthonyfok as I said earlier, I would expect this to just work, as we just use .Page.RelPermalink() to do the heavy lifting, and that method is heavily tested, also with sub-paths.

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

I can still reproduce this with the latest version of Hugo ( Hugo Static Site Generator v0.34 linux/amd64 BuildDate: 2018-01-22T12:06:40Z )

It seems to happen when canonifyURLS = true

I can confirm this bug/behaviour.

  • hugo server --navigateToChanged
  • When modify a file.md file the browser refresh directly to http://localhost:1313/file/ instead of http://localhost:1313/caiman/v1/file/
  • Hugo 0.47 on MacOSX
  • config.toml
baseURL = "https://www.example.com/caiman/v1/"
canonifyURLs = true

EDIT : If I put canonifyURLs = false the refresh URL is correct.

If I put canonifyURLs = false the refresh URL is correct.

Digging this old post (bited me again) ...

Easy workaround (_thanks to Bep comment_) is to :

  • keep your baseURL with folders
  • run hugo with basic baseURL : hugo server --navigateToChanged --baseURL "http://localhost:1313"

HTH

Was this page helpful?
0 / 5 - 0 ratings