Using subdomains for subdirectories

Hi everyone,

I’ve been on a bit of a journey to figure this out and think I must be missing something obvious.

In short, I have a domain (‘’) with a few subdirectories (‘’, ‘’). The site is Jekyll-based and lives in one GitHub repo. I want to have the subdirectories use subdomains (e.g. ‘’, ‘’) but can’t figure out how to do this.

Things I’ve tried:

  • Configuring a redirects file (doesn’t achieve the intended behaviour)
  • Looking at setting up forwarding for the subdomains (doesn’t seem possible)
  • Browsing these forums/Google to find other options (no luck)

From what I understand, the solution is to deploy multiple sites on Netlify and set each of those up with a subdomain. This brings me to my questions:

  1. Is this the best approach?
  2. To keep things simple, I’d like to keep it all in the same repo. Is there any way to deploy from one repo and have the base page different? e.g. one of them loads to ‘index.html’, one should load to ‘page-a.html’ and one to ‘page-b.html’. I assumed there might be a build command but I can’t figure it out
  3. Am I missing anything obvious?

Thanks for your help and sorry if these are silly questions. I’m entirely self ‘taught’ and am pretty sure I have some big gaps in my understanding.

I’m unaware of another way to do it, I’ve always configured as separate sites and it works.

There is no concept of a “base page”, if you wanted page-a.html to be the “base page” of a certain build, then you would do something like mv page-a.html index.html, to overwrite the index with page-a so that it’s served by default for that build.

Alternatively you could build the different “sites” to different folders, and set the Publish directory separately for each site.

Not that I’m aware of, just try a few things.

Thanks Martin, appreciate it.

Where would I run the command you mentioned? Would that be in the build command field alongside the jekyll serve command?

@BobbyC It would be in your build command or a custom script that you write and call.

You won’t want to run jekyll serve on Netlify, that’s for running a development server and will just eventually time out.

You would use jekyll build on production, as seen in the Jekyll documentation:

Of course, silly mistake. Thanks for all your help Nathan, appreciate it.