kingsfoil
kingsfoil

Reputation: 3875

Where to find default layouts in Jekyll

The default site setup for a new Jekyll site has a layout specified as "home" in index.md:

---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
---

If I follow the link, it tells me to create a _layouts folder and create a file in it named home.html and that will be used as the home layout. But if that file doesn't exist Jekyll defaults back to the normal home page.

Where is Jekyll pulling the default layout from?

Upvotes: 6

Views: 4055

Answers (2)

user5534993
user5534993

Reputation: 600

From this version of the manual:

Run bundle info --path followed by the name of the theme's gem, e.g., bundle info --path minima for Jekyll's default theme.

The layout files will be in the _layouts sub-directory of the path returned by the command above.

Upvotes: 4

Mr. Hugo
Mr. Hugo

Reputation: 12600

This default layout comes from the theme, which is gem based and is stored on your computer.

To locate a theme’s files on your computer:

Run bundle show followed by the name of the theme’s gem, e.g., bundle show minima for Jekyll’s default theme. This returns the location of the gem-based theme files. For example, the Minima theme’s files might be located in /usr/local/lib/ruby/gems/2.3.0/gems/minima-2.1.0 on macOS.

Source

I would suggest to start without a theme. Invisible files do not really help you to understand an already quite abstract concept. Remove the theme and write your own layouts and CSS. When you get how it works, you also truly understand how a theme works and what it can and cannot do.

Removing the standard (or any other) theme is simple. Just go to the _config.yml file and remove theme: minima. Now you will use only visible files. You might also want to remove the 'Gemfile', but that requires you to also remove the 'jekyll-feed' plugin from the config. No problem, as you can easily roll your own: https://jekyllcodex.org/without-plugin/rss-feed/

Upvotes: 7

Related Questions