Hi,
Building my first site with Hugo - basically I’m migrating a blog from Blogger.
I followed the documentation and set up a new site as explained, with the default directory structure. Installed a theme (“mainroad”) and put all my content in place. So far everything works beautifully from localhost:1313 (running the Hugo web server locally on Windows).
But here’s the problem: I’m not going to publish the site to my domain root – the location will be “/blog”. No matter what I try, I can’t get Hugo to successfully set up this structure on localhost.
- If I set BaseURL in my config to “/blog”, Hugo says
Web Server is available at //localhost:1313///blog/
. But all get there is “404 not found
”, even if I remove “/blog” from the accessed URL. - If I try to additionally modify the directory structure, I either get more 404s or Hugo cannot find the content for building the site.
- I also tried playing with
relativeURLs
andcanonifyURLs
, but no luck. - Tried using different themes just for testing - I get the same symptoms with all of them so I’m confident it’s not a theme-specific issue.
The Hugo docs don’t cover this situation (they seem to assume that the site will be at the domain root). Strangely enough I can’t find any relevant discussion either, except for threads like this… with encouraging things like “Figured out!” and “It works, don’t worry”, but no actual explanation.
So for anyone who has their site running off a subdirectory: How do you do it? And how should I set it up locally, in terms of directory structure and config parameters?
BTW, here’s my environment if it helps any:
Hugo Static Site Generator v0.37.1 windows/amd64 BuildDate: 2018-03-07T17:56:57Z
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.10"