Jekyll: installing a gem based theme

I was able to create my first static website with Jekyll v3.4.3. Now I would like to change the default "minima" theme to another gem based theme like jekyll-theme-minimal

As far as I understood, according to the jekyll documentation, this would simply require the following steps:

1.- Add theme to your sites Gemfile:

gem "jekyll-theme-minimal", "~> 0.0.3"

      

2.- Install the theme:

bundle install

      

3.- Add _config.yml to your sites to activate the theme (comment out "minima" and add a new one):

theme: jekyll-theme-minimal

      

4.- Build your website:

bundle exec jekyll serve

      

I followed the steps below, but creating the site (step 4) results in the following error:

$ bundle exec jekyll serve
Configuration file: /home/username/jekyll/myblog/_config.yml
Configuration file: /home/username/jekyll/myblog/_config.yml
            Source: /home/username/jekyll/myblog
       Destination: /home/username/jekyll/myblog/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
     Build Warning: Layout 'post' requested in _posts/2017-03-22-welcome-to-jekyll.markdown does not exist.
  Liquid Exception: Could not locate the included file 'icon-github.html' in any of ["/home/username/jekyll/myblog/_includes"]. Ensure it exists in one of those directories and, if it is a symlink, does not point outside your site source. in about.md

      

I see that a new gem based theme is installed

$ bundle show jekyll-theme-minimal
/home/username/.gem/ruby/2.4.0/gems/jekyll-theme-minimal-0.0.3

      

But I noticed that the new theme does not have a _includes directory. Also, I can see that the about.md file in my Jekyll sites directory still links to the default "minima" theme:

$ cat ~/jekyll/myblog/about.md 
---
layout: page
title: About
permalink: /about/
---

This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/)

You can find the source code for the Jekyll new theme at:
{% include icon-github.html username="jekyll" %} /
[minima](https://github.com/jekyll/minima)

You can find the source code for Jekyll at
{% include icon-github.html username="jekyll" %} /
[jekyll](https://github.com/jekyll/jekyll)

      

How can I change the default "minima" theme on my site to another gem based theme?

+3


source to share


1 answer


The Jekyll theme documentation defines a general procedure for using a new theme, but since the flexibility is very Jekyll, it cannot guarantee that every theme will work out of the box.

Jekyll's default installation, comes with sample data, page layout and includes.

The minimal theme has a default layout and no include , because the example posts that ship with Jekyll use include > and use the page layout , it won't work.

After installing the minimal theme, you need to make sure all your posts have layout: default as their layout (no layout: pages or whatever) and no posts...



In this case, after configuration about.md

, it will look like this:

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

This is the base Jekyll theme. You can find out more info about customizing your Jekyll theme, as well as basic Jekyll usage documentation at [jekyllrb.com](https://jekyllrb.com/)

You can find the source code for the Jekyll new theme at:
[minima](https://github.com/jekyll/minima)

You can find the source code for Jekyll at
[jekyll](https://github.com/jekyll/jekyll)

      

Or, if you do not want to change the content of the messages, just select the missing incoming and / or layouts that create these folders and create the appropriate missing files that you want to use with a new theme, you're not limited only in that it uses topic Overriding themes of default

+3


source







All Articles