Devlog Part 3 - Project Structure
Typical Jekyll Project Structure
The folder structure of a Jekyll site changes depending on if you are using a gem-based theme or not. A basic Jekyll site usually has a file structure that looks like this:
.
├── _config.yml
├── _data
│ └── members.yml
├── _drafts
│ ├── begin-with-the-crazy-ideas.md
│ └── on-simplicity-in-technology.md
├── _includes
│ ├── footer.html
│ └── header.html
├── _layouts
│ ├── default.html
│ └── post.html
├── _posts
│ ├── 2007-10-29-why-every-programmer-should-play-nethack.md
│ └── 2009-04-26-barcamp-boston-4-roundup.md
├── _sass
│ ├── _base.scss
│ └── _layout.scss
├── _site
├── .jekyll-cache
│ └── Jekyll
│ └── Cache
│ └── [...]
├── .jekyll-metadata
└── index.html # can also be an 'index.md' with valid front matter
The Jekyll documentation provides an overview of what each of these folders and files does.
File / Directory | Description |
---|---|
|
Stores configuration data. Many of these options can be specified from the command line executable but it’s easier to specify them here so you don’t have to remember them. Here is a list of available settings. |
|
Drafts are unpublished posts. The format of these files is without a
date: |
|
These are the partials that can be mixed and matched by your layouts
and posts to facilitate reuse. The liquid tag
|
|
These are the templates that wrap posts. Layouts are chosen on a
post-by-post basis in the front matter. The liquid tag
|
|
Your dynamic content, so to speak. The naming convention of these
files is important, and must follow the format:
|
|
Well-formatted site data should be placed here. The Jekyll engine
will autoload all data files (using either the |
|
These are sass partials that can be imported into your |
|
This is where the generated site will be placed (by default) once
Jekyll is done transforming it. It’s probably a good idea to add this
to your |
|
Keeps a copy of the generated pages and markup (e.g.: markdown) for
faster serving. Created when using e.g.: |
|
This helps Jekyll keep track of which files have not been modified
since the site was last built, and which files will need to be
regenerated on the next build. Only created when using
incremental regeneration (e.g.: with |
|
Provided that the file has a front
matter section, it will be transformed by Jekyll. The same will
happen for any |
Other Files/Folders |
Except for the special cases listed above, every other directory and
file—such as |
Every file or directory beginning with the following characters: .
, _
, #
or ~
in the source
directory will not be included in the destination
folder. Such paths will have to be explicitly specified via the config file in the include
directive to make sure they’re copied over:
include:
- _pages
- .htaccess
Devlog Structure
However, our file structure is much simpler, since we are using the gem-based theme minima1, so it looks something like this:
.
├── 404.html
├── Gemfile
├── Gemfile.lock
├── README.md
├── _config.yml
├── _posts
│ ├── 2024-06-04-welcome-to-jekyll.markdown
│ ├── 2024-06-05-congressional-day-1.md
│ └── 2024-06-05-sample-post.md
├── about.markdown
└── index.markdown
1 directory, 10 files
Conclusion
As the Jekyll documentation explains:
The goal of gem-based themes is to allow you to get all the benefits of a robust, continually updated theme without having all the theme’s files getting in your way and over-complicating what might be your primary focus: creating content.
After you write the settings you want, such as website name, author, site description, etc. in your _config.yml
document, we can begin writing new posts.
Next: Part 4 - How to write a new devlog entry
Footnotes
-
The installation of a gem-based theme is defined in your
Gemfile
. To see where the theme was downloaded in your computer, runbundle info minima
in your terminal. This will output a summary, a link to the theme’s homepage, and a file path where the gem is installed, such as/Users/pablo/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/minima-2.5.1
. ↩