Make home to be Subdirectory

Figured out! I did many trial and errors. Kukuku… many are viewing but none are replying. But well… splendid!

Nobody apparently had an answer. You found an answer by trying. I just joined here minutes ago. It would be helpful to hear how you did it :slightly_smiling:

1 Like

It works, don’t worry.
I use Hugo on two domains in subfolders.

1 Like

I use following works in my config.toml and it works.

baseurl = "http://example.com/blog/"

But the imags are still broken. Will update if I figure it out.

This is apparently a common issue with no real answer easily found.

could you try looking at the theme to see if there is /js instead of $.Site.BaseURL/js etc., ?

1 Like

But you then failed to mention what exactly you figured out :slight_smile:

In any case, closing the loop; see the solution here:

1 Like

I finally got around to fix my site :slight_smile:

baseurl = "//example.com/blog/"

RelativeURLs=true
CanonifyURLs=true

These are the relevant settings. It seem to work without CanonifyURLs=true but I read that the two settings interact with each other.

The best way for me to fix the problem is to create a subdomain. Then, even if the web site is physically hosted in a subfolder, the baseurl value doesn’t have to add a suffix with the subfolder name.

As an example:

Physically the site files are stored in www.example.com/blog/
Create a sub domain blog.example.com that points to www.example.com/blog/
In config.toml adapt the value of baseurl (baseurl = “https://blog.example.com/”)

Then it works, images are displayed, path to css is correct, etc…