40

So I followed the guide on the Jekyll website by installing and running Jekyll (sure I don't have to post this here). And the site is up and running perfectly but for some reason I don't see the _layouts directory that's supposed to be there. In the pages I can see that it references some layouts i.e:

index.html

---
layout: default
---

<div class="home">

about.md

---
layout: page
title: About
permalink: /about/
---

This is the base Jekyll theme.

But when you look at the directory stucture of the project:

enter image description here

No layouts folder.. what's up with that? Everything works though. And it looks perfectly fine when run on localhost.

3 Answers3

32

You must be running the recent Jekyll version 3.2, which introduces Gem based themes (from https://jekyllrb.com/docs/themes/):

Jekyll themes package layouts, includes, and stylesheets in a way that can be overridden by your site’s content.

The theme is set in _config.yml:

theme: minima

Initial files that were previously in _layouts, _includes, and _sass are now packaged with the theme.

Ross
  • 2,701
  • 16
  • 25
  • Perfect! Thank you very much :) –  Aug 11 '16 at 09:05
  • 3
    Is there a way to add a new Jekyll 3.2 website withouth the minima theme? – Toontje Aug 24 '16 at 14:26
  • 1
    Yes, just remove the `theme: minima` line from your `_config.yml`. You could copy the theme files to your site as well if you wanted to keep the starting point: https://github.com/jekyll/minima – Ross Aug 25 '16 at 01:15
  • Is there any automatic way to do this? i.e. without downloading from github? – bozdoz Sep 24 '16 at 01:21
  • You could copy the files from where bundle installs them instead. I've been using an older version of Jekyll to generate new sites: `jekyll _3.0.3_ new .` (assuming macOS with Jekyll 3.0.3 installed). – Ross Sep 25 '16 at 22:19
  • I don't see the themes folder for `minima`. – zachdyer Oct 06 '16 at 04:00
  • @zachdyer I'm not sure what you mean. If you're still having issues it's probably better to ask in a new question. – Ross Oct 07 '16 at 02:02
  • I guess I didn't have the minima theme installed. However I solved the problems I was having by deleting the gem files and adding the `_layouts` folder and other Jekyll folders to the root directory. Then it started working just fine. – zachdyer Oct 07 '16 at 16:45
  • 1
    So if I want to build off of the minima theme, say adding a header.html include, how would I go about doing this? Would I have to make a new theme entirely? – Nic Aguirre Dec 01 '16 at 21:09
  • To clarify then, if one wants to make additions or modifications to their layouts, they must either manually create folders and copy files from somewhere under _site, or they must modify a gem and maintain a custom gem? If so, both options seem quite user-unfriendly. A step or two more in that direction and we might as well just hand-code a site like we used to. – michael_teter Oct 14 '18 at 06:38
14

Basically Jekyll wants you to use themes, so you can't see _layouts, _includes, _sass, _assets anymore.

To use previous behaviour simply copy from the gemfile:

open $(bundle show minima)

Copy the 4 folders into your jekyll directory

Jeremy Lynch
  • 6,780
  • 3
  • 52
  • 63
2

If you want the older style of Jekyll website directory which includes all the 4 folders then you can use this command : jekyll new my-new-website-name --blank I have done the same while creating a personal site.

Abhipsa Mishra
  • 77
  • 1
  • 1
  • 7
  • This just seems to initiate the some directories. The default theme which we can edit is not present here. – agent18 Oct 18 '20 at 16:51