Unsure/Unable to Publish Jekyll blog to DOMAIN.com/blog instead of DOMAIN.com


I want to setup my site so it can be on domain.com /blog rather than the main domain so I can setup a portfolio on the main domain.com I have looked around all day and am unsure how to do it.

@KaptianCore You could create it as one site, where the build outputs the main site files to the root / and the blog to /blog/, or you can set it up as two sites and use a proxy on the main site to point /blog/ to the second site.

I read that post but it makes 0 sense what I actually have to do to my jekyll site and netlify to change that up

@KaptianCore I have no idea what post you’re referring to, but you may want to give it another read.

I’m just speaking from the perspective of someone that achieved it both ways previously, albeit not specifically with Jekyll, but the principles remain the same regardless.

Sorry not the post but the link to the documentation. I don’t understand what I am actually meant to do but my brain is pretty destroyed atm lol

If you’re doing it “all in one site”, you just literally create a project structure and build that creates the site with some files at the root / and some files in a folder of /blog/, exactly as you would if you were manually creating static files.

If you’re doing it as “two sites”, you would create two sites within Netlify:

  • Site #1
    Your “main site”
    What you want to serve from the root of domain.com
    You set this project up to build the main site
    You add the _redirects file with the proxy to this site

  • Site #2
    Your “blog site”
    What you want to serve from /blog/ path (domain.com/blog/)
    You set this project up to build the blog site

The _redirects file with the proxy would contain something like…

/blog/*  https://your-blog-site-name-here.netlify.app/:splat  200

So that when the main site is viewed, and a path like domain.com/blog/my-article is requested, the proxy causes the file from your-blog-site-name-here.netlify.app/my-article to be returned.

It’s not necessary to set the blog up as a separate site, people just tend to do it if their blog is built with a different system from the main site.

1 Like

Alright so I dont have to setup the jekyll hosted one any differently?

@KaptianCore I can’t answer that question, since I don’t know what the “jekyll hosted one” is.

From what little you’ve mentioned so far, I’d presumed that you were building both your “main site” and your “blog site” with Jekyll and were hosting both with Netlify.

If that’s not the case, and you need help with something else, then you should provide appropriate details.

I have a website that runs on Jekyll which is my blog which is currently on my main domain.

I am building a portfolio not with jekyll and I want to be able to host it on the main domain and then have the blog on /blog.

Let me know if I am missing any details I apologise if its confusing.

@KaptianCore Excellent, well it can be done either way as explained, depending on your own preference.

If setting up with two sites it will likely be easiest to leave the existing site “as is”, create a new site instance for the portfolio site, get it all working with the proxy in place, and then when you’re ready remove the custom domain from the blog site and add it to the portfolio site.

1 Like

Alright so just relaying and making sure I understand what I need to do.

Once my portfolio site is ready remove the domain from my blog, then setup the proxy on the portfolio site and then it should work? I don’t have to configure anything on the blog side?

@KaptianCore You can set the proxy up before, if you check the Netlify documentation you’ll see they recommend that you proxy to the sitename.netlify.app url anyway (not to your own domain).

That way you can test it all before doing anything else.

You may even be able to do it the other way around with a different set of redirects/proxies.

1 Like

Hi, I believe that’s how you can achieve this using two sites:

  1. Create the portfolio site as you’d like to, and add a _redirects file with rules like this:
/blog/:splat https://blog.yoursite.com/* 200!

This is a modified example from Redirect options | Netlify Docs
It could invoke some cross-site loading issues, we need to see how it would go.

  1. Manage your domains. Maybe you would want the blog site to use only Netlify-domain and not show it to the search engines. Configuring _headers will help.
1 Like

This is the solution, didn’t see it when I was posting mine :slight_smile:

If any questions still remain, try it on a dummy sites, it always helps me.

1 Like

Okay, so I set up a temp website for placeholder but when I go to the /blog the css is completely wrecked and wont load properly? Brady Joosse

The assets as seen in the screenshot below are not prepended with /blog rather referencing files at the root of the main domain.

The downside of prepending them with /blog is that the blog, when viewed on its own domain will not work.

Trick I have used is to house the /blog on that path on the proxied-to domain. This has issues too in that 404 pages don’t show as intended (at least I haven’t found a way to make them work properly.)

I don’t believe there is a perfect solution.

Im not really sure what u are suggesting I do?

Okay, so it now goes to the homepage but it says it cant find a page when any sub page (which it does go to the wrong thing but even when I fix the URL it is broken)

Here is the URL for the first post


Notice how it is missing /blog?

Yes but even when I add the blog it still says its missing

I assume fixing it so its /blog is something I have to change on the jekyll config but why would the page be missing?