GitHub Pages show my page differently from my localhost maybe because of _include

This is my blog hosted by GitHub Pages
This is my repository
The pages hosted by GitHub displays its different appearance from what I see on my localhost:4000 pages.
That is because default layout that I use for all pages on my site do not insert the head.html although you can see “{% include head.html %}” on the file below.
Of course, I committed the head.html within the _includes directory as you can see below.

Could you give me an advice about this problem? I tried to look for it, but some say something about GemFile, some say something about root directory.
I don’t get it. Sorry.

not sure, but it looks like the blog folder has your jekyll site, but it is not the root of your repo, it is a sub folder in there.

Maybe GH will only build the jekyll site properly if it is at the root of the repo? that can’t really be true though cause it did build the file.

To be clear, which page is broken? the home page of the blog? or the blog post itself - that is the one that looks totally wrong, no head. Does the home page of the blog look ok? or should it match the main site?

I think ideally the config file for jekyll and the layouts and includes and what not would be in the root of the repo - not in the sub folder called blog.

1 Like

Here is what it is supposed to look like.

So, all we see on this website are broken.

you can not host your files in a blog directory, see GitHub Pages documentation for more information.

You can use a docs folder though.
Make sure you config file specifies the remote_theme you want to use.

1 Like

It works! after I move it in the root directory! Thank you so much!
I wanted to put Jekyll on a sub directory for the sake of whole site’s independency, but that may be totally okay.
I think I can make many layouts for as less independency as possible.
If there is something good to know, let me know.
Thank you.

You can define source in your _config.yml with Jekyll but this setting is overriden on GitHub Pages.

Here is an example repo:

As source is overriden, posts don’t show on GitHub:

Note: if you want your layouts files to be independent from your content, you could develop a custom gem-based theme and then just use theme: your-base-theme in all your jekyll websites.

If you feel GitHub Pages has too many restrictions for custom config and themes, I would recommend you check out Netlify to publish and host your site, you can use whatever config your want there.

The same GitHub repo linked to Netlify:

Custom settings applied! :smile: