How do I show two Jekyll blogs on one domain?

Hi there, I can’t find a ‘howto’ for this, so here goes…

In my attempt to liberate my old blog from Wordpress and to start a new blog as well, I have built two Jekyll blogs in two different repos:

  1. /jimken123/ohpiglet displaying on GitHub Pages as /ohpiglet/
  2. /jimken123/nu-blog displaying on GitHub Pages as /nu-blog/

I own mydomain.com and I want to serve the two blogs as follows:

  1. /nu-blog/ → mydomain
  2. /ohpiglet/ → mydomain/ohpiglet

Q1. Is this possible from two repos or do I need to merge them? I’d prefer to keep them separate.
Q2. Should I use subdomains instead?
Q3. Is there a better way I haven’t seen?

Hello,

If you plan to separate old content from new content, you could create a folder structure just as you suggest. Here’s a video I made a few years back that walks you through that “folder” method:

After you watch this video and try it out, you will understand how to lay out your site, and you might have more questions.

If you care about Google search rankings, you must carefully consider whether to retain the original site URLs for your old blog. If you create a brand new site with brand new URLs for your blog, then Google will treat that as “new” and not a “replacement,” so you will have to rebuild Google’s search engine trust again.

If you are unfamiliar with Jekyll site development, you might want to start with the first video in my series and watch through to the “multiple blogs and feeds” video I share above.

Also, I mention GitHub Pages a lot here, but most of this is generic Jekyll stuff, so do not worry if you are not limited to just GitHub Pages.

Thanks Bill! I think my usecase is somewhat different to yours in that my two blogs are completely different ((themes, configs, everything) - one is based on { Personal } Jekyll Theme and the other on Forever Jekyll. So a second _posts folder inside the first _post folder won’t be nearly enough, it will be more like an entire repo inside another repo, and that will get very messy very quickly…

Could you please explain what you use those two different blogs for and why they should be together but separate? By keeping Jekyll out of this for the moment, we can better understand your requirements and help you define a solution.

Sure! The main blog is about my kids, to keep in touch with my mother because we live abroad. It has ~4000 posts going back 14 years. The other one is new, intended for me talking about politics, books, whatever. So different audiences.

They are both already in Jekyll, one as a migration from WP and the other new.

‘Together’ because:

  • both will be served on my existing domain name.

‘but separate’ because:

  • different audiences.
  • built completely differently.

For clarification they are here:

If you set up jimken123.github.io to use your custom domain, ohpiglet will automatically show up under yourdomain.com/ohpiglet:

Make sure to configure baseurl correctly to include /ohpiglet, or all relative links will be messed up.

I think @bewuethr is providing you with the best solution here.

This unfortunately didn’t work from two repos.

So, here’s what I figured out from the replies here (thanks!), a lot of stackoverflowing, and a lot of trial and error.

If you want to pipe two repos (for example, foo and bar) to one website, there are three ways to do it:

  1. Move one repo inside the the other one as a folder, so you have foo and foo/bar. Then ‘call’ each folder to a different url in the website, for example, foo → mydomain.com/ and foo/bar → mydomain.com/bar. I didn’t actually try this because it would be huge folders in my case, a maintenance nightmare, and there would be possible conflicts with competing index pages, config files, css, etc.

  2. Submodules. Retain the repos foo and bar, but set up bar as a submodule inside foo. I didn’t actually try this way because it seems to be a maintenance headache afterwards, and tricky to push the correct repo updates.

  3. Subdomains. Rename foo repo to my-github-name.github.io, retain the bar repo. Custom domain my-github-name.github.iomydomain.com. Set up the subdomain bar.mydomain.com and custom domain bar → bar.mydomain.com. This works pretty much out of the box.

So in my case I have:

jimken123/jimken123.github.io → https://mananamanana.com
jimken123/ohpiglet → https://ohpiglet.mananamanana.com
jimken123/dublinopinion → https://dublinopinion.mananamanana.com
…etc…

Now to figure out the remaining problem of _posts ignoring css…

How did it “not work”? I have this exact setup operational.

Can you link me to your repos please? I’d like to have a look.

The setup with Jekyll running on both types of repos is in an Enterprise org and not public, but here’s an example of two repos with the same URL structure: