Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Github pages with Jekyll in a subdirectory

I recently wanted to publish my Jekyll site on Github pages, but it seems that putting everything in a subdirectory is giving some issues, even after I change the source to the correct directory.

My structure looks like this:

- site
   - src (contains all Jekyll stuff)
   - README.md
   - GruntFile.js
   - ...

Locally my site builds perfectly and when I go to http://localhost:4040 I can see it just nicely, but when I commit this to my Github and visit username.github.io I get a 404, if I go to username.github.io/src I can see part of my site, however all {% include %} are ignored.

In my _config.yml I updated the source: source: ./src, but that doesn't seem to help.

Is there a way to make Github Pages handle subdirectories properly? Basically I want to tell it that my Jekyll site is inside /src, and I want the url to just be username.github.io instead of username.github.io/src

I know i can use the pages branch and commit to there, but I would prefer if it could happen automaticly.

like image 854
woutr_be Avatar asked Dec 26 '13 10:12

woutr_be


2 Answers

If it helps anyone, I attempted to run Jekyll on GH Pages from a subdir (and modified source) and was banging my head against the wall over these errors:

A file was included in subdir/index.html that is a symlink or does not exist in your _includes directory. For more information, see https://help.github.com/articles/page-build-failed-file-is-a-symlink.

After much searching on this, the definitive answer was right there in the docs:

Configuration Overrides

We override the following _config.yml values, which you are unable to configure:

safe: true
lsi: false
source: your top-level directory

Keep in mind that if you change the source setting, your pages may not build correctly. GitHub Pages only considers source files in the top-level directory of a repository.

like image 182
Todd Menier Avatar answered Sep 22 '22 17:09

Todd Menier


I contact Github support and they gave me 2 solutions.

  1. Move all my Jekyll source files to my top-lever directory.
  2. Use a different branch and update it manually each time.
like image 37
woutr_be Avatar answered Sep 19 '22 17:09

woutr_be