Building Jekyll Site Basics

Hi

I am curious as to what is the ‘correct’ way to build a Jekyll site is. I’ve gone through the quick start a few times and have notice a few things…

For one, I’m unsure as to if after I “mkdir blog > cd blog > $ gem install jekyll bundler > jekyll ./ > bundle exec jekyll serve” honestly where to go from here. Also should i be gem install jekyll bundler in every folder i create a jekyll project?

Second, after I’ve got the jekyll build structure set up… I’m a little unsure really about as well about ‘building’. Should a build be ran “jekyll build” after I’ve developed my site or does this need to be ran prior to creating what is desired/what I develop…

Third. After I’ve iterated over the previous to correctly do I need to run a dynamic jekyll command to create my _layouts and _includes or could i possibly just right click and create a new folder “not dynamically”.

Since static pages should be in _layouts if i believe correctly will that only be referenced in the “Front Matter” or with this in liquid syntax be delcared in the actual page desired if that makes sense. If i wanted a “home.html/.md” where the index.html/.md is referencing the post that auto populates as always would that be delacred in that post front matter or somewhere else.

As well once i’ve built the structure out, where will i be working… in the root or _site or _dest. Im thinking not _dest but just need to get clear answer. Thanks…

1 - you don’t need to gem install jekyll each time.

2 - while developing the site normally you would do jekyll serve which spins up a simple web server and previews your site. When you are happy with it and want to deploy a live production site you should do jekyll build. Serve and build are slightly different.

3 - If you are using the default jekyl new myblog site, it is using a theme which is sort of hidden from you - layouts and includes I think are in the themes gem folder and are hidden unless you tell it to show it to you. I don’t like this, especially for beginners as it makes it seem as if there is a lot of magic going on when there really isn’t.

4 - _Layouts is for layouts only - not for normal static files. Normal files like contact.html would go in the root folder or a subfolder in the root.

5 - you always work in the root, never the _site folder - the _site folder gets wiped clean every time the site rebuilds.

Jekyll can be complex when you start, but once you get the hang of it it is really simple and easy to work with (mostly).

I highly recommend this series on yourtube:

https://www.youtube.com/watch?v=oiNVQ9Zjy4o&list=PLWjCJDeWfDdfVEcLGAfdJn_HXyM4Y7_k-

That series is a little old, and I think it is before the themes stuff was added.

1 Like