HUGO

Need help with baseurl for my unorthodox site structure

Hello! I am a networking beginner here and I must admit I have hit a roadblock. essentially my site (https://evn.netlify.app) is part of two netlify sites

  1. (main site) - deploys from root/src
  2. (hugo) - deploys from root/blog/public of the same repository

I don’t think this is the correct way to achieve this, even though it sort of works, its messy - so if someone has some advice on that I would love to hear it - but that’s not the issue.

evn.netlify.app (the main page) is from the src folder - however there is a _redirects rule (/blog/* https://evnblog.netlify.app 200!) to sneakly redirect users to where the blog is actually hosted by netlify (https://evnblog.netlify.app).

the issue is that when https://evnblog.netlify.app is directly visited the css loads perfectly, but when it is visited via the main page (https://evn.netlify.app) the css does not load at all.

I don’t care about breaking the css of evnblog, as long as it works on the /blog subpage.

After some googling I learned it has to do with the baseurl property of config.yml . believe I have tried all the base urls, and none have worked on evn.netlify.app/blog (its possible I missed one so if one seems it should work than I probably just missed it)

  • “/”
  • "https://evn.netlify.app"
  • https://evn.netlify.app/blog
  • "https://evnblog.netlify.app"
  • "https://evnblog.netlify.app/blog"

if anyone has any help as to what should be in base URL for this use case I would love to hear

I don’t understand your “layout”, but to my knowledge baseURL = '/' is the way to go if you want multiple domains have the same folder structure and the same files. If your CSS is on both sites at style.css then it will work with a slash in baseURL. You will/might run into issues with RSS files though.

The css is then probably linked to blog/whereeveryourstylesheetsreside/style.css.

In the end: if your structure is unorthodox - try come inside the orthodoxy :wink: The problem is deeper. Why would you need two/three/four URLs for your website.

Hey david, thanks for responding. I got it working a few hours ago, not sure how.

How would you suggest I make it more orthadox?

Hi @boehs, david is my neighbour :wink:

Anyway: I would put all your web pages into one single website. Hugo can deploy into a subfolder if you tell it so in config.toml: Configure Hugo | Hugo > publishDir.