Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Jekyll running just for a subdirectory on Github

I'm trying to set up a portfolio page using Github Pages. I'd like to have part of this include a blog, and have set up a /blog folder, where I created a new Jekyll project. The main site is not Jekyll powered, just this subdirectory.

When I start Jekyll on the subdirectory folder, it displays correctly. After uploading it to Github, however, everything seems to go wrong and nothing shows up. This can be seen at http://rjbman.github.io/blog/.

Is there anything special I need to do in order to have Jekyll run exclusively from this subdirectory? I searched around and found Site root: Github Pages vs. `jekyll --server`, but this didn't fix it for me.

All source code can be found at https://github.com/rjbman/rjbman.github.io

EDIT: Unfortunately I wasn't able to find a solution besides re-doing the site so the whole site ran Jekyll. Jekyll will still put any static html pages into the directory and added a lot of flexibility. And with the permalink option in the _config.yml, I'm still able to have everything under /blog/.

like image 654
rbonick Avatar asked May 01 '14 21:05

rbonick


People also ask

Can I use GitHub Pages without Jekyll?

If you want to use a static site generator other than Jekyll, we recommend that you write a GitHub Actions to build and publish your site instead. Otherwise, disable the Jekyll build process by creating an empty file called .

How does Jekyll work with GitHub Pages?

Jekyll is a static site generator with built-in support for GitHub Pages and a simplified build process. Jekyll takes Markdown and HTML files and creates a complete static website based on your choice of layouts. Jekyll supports Markdown and Liquid, a templating language that loads dynamic content on your site.

Does GitHub use Jekyll?

GitHub Pages are powered by Jekyll behind the scenes, so they're a great way to host your Jekyll-powered website for free. Your site is automatically generated by GitHub Pages when you push your source files.


1 Answers

It seems that you have found a workaround since posting your question, but I'll answer this in case you (or others) are still interested.

There are two types of GitHub Pages sites:

  • User/Organization sites
  • Project sites

User/Organization sites are rooted at the top level like: http://rbonick.github.io/ and are on the master branch of the repo with the site name (i.e., rbonick.github.io).

Project sites are on the gh-pages branch of a repository and the URL is a concatenation of the USer/Org site URL + the name of the project site repository.

So, if you wanted to only use Jekyll for the blog part of your site, you could do the following:

  • make a repo called 'blog'
  • move your blog-related code (along w/ Jekyll-related code and config file) to your 'blog' repo on the gh-pages branch
  • modify _config.yml, etc. as needed to reflect this change
  • for convenience, goto GitHub settings for your blog repo and change the default branch to gh-pages if you have other branches in your blog repo

After doing that, http://rbonick.github.io should be working Jekyll-free as before and http://rbonick.github.io/blog/ should work as your Jekyll-based blog.

like image 133
Mike Covington Avatar answered Jan 03 '23 23:01

Mike Covington