Hemanth.HM

A Computer Polyglot, CLI + WEB ♥'r.

Jekyll Blog From a Subdirectory

| Comments

Say you have a site example.com running on jekyll and you want example.com/blog to also be served from the same jekyll setup, here is what you need to do :

  • cd ~/example.com -> Root dir.

  • cd _includes -> Add a blogskin.html that would contain all the required css and js.

  • cd _layouts and create a blog layout that each of your blog posts will use, don't forget to Included file 'blogskin.html' not found in _includes directory

  • mkdir blog -> This would be the index for example.com/blog and hence must contain the index.html static file, listing all the blog posts, similar to an index file that jekyll new would generate, have a layout: blog so that index and the blog posts look and feel remains in sync.

  • echo "permalink: /blog/:title.html" >> _config.yml -> This would be premalink format for your blog posts.

Now, a jekyll build && jekyll server must have example.com/blog serving your blog :-)

Hope this helps, not sure if a bash script to do this will help more, will decide after some feedback ;)

This was a part of my learning gained while preparing yeoman's team blog.

Comments