Saurabh
Saurabh

Reputation: 462

Build Warning: Layout 'XXX-layout' requested in index.md does not exist in Jekyll?

I have created a theme of my own using Jekyll named 'north' which I have created by myself.

After creating the theme I got a gem file as 'north-0.1.0.gem' and gemspec file as 'north.gemspec'.

I took both of these file and paste inside a folder named 'north' inside a new project 'docs'.

north.gemspec

frozen_string_literal: true

Gem::Specification.new do |spec|
  spec.name          = "north"
  spec.version       = "0.1.0"
  spec.authors       = ["kumar.saurabh"]
  spec.email         = ["[email protected]"]

  spec.summary       = "test."
  spec.homepage      = "https://wkrepo.abc.com/saurabh.kumar/uvtheme/tree/2.0"
  spec.license       = "MIT"

  spec.files = `git ls-files -z`.split("\x0").select do |f|
    f.match(%r{^(_(includes|layouts|sass)/|(LICENSE|README)((\.(txt|md|markdown)|$)))}i)
  end

  spec.add_runtime_dependency "jekyll", "~> 3.8"

  spec.add_development_dependency "bundler", "~> 1.16"
  spec.add_development_dependency "rake", "~> 12.0"
end

_config.yaml

# Build settings
markdown: kramdown
theme: north
plugins:
  - jekyll-feed

index.md

---
# Feel free to add content and custom Front Matter to this file.
# To modify the layout, see https://jekyllrb.com/docs/themes/#overriding-theme-defaults

layout: page-sidebar-layout
---

Gemfile

gem "jekyll", "~> 3.8.5"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "north", "0.1.0", :path => "north/north-0.1.0.gem_FILES"

Error:

In terminal:

Invalid theme folder: _sass
Invalid theme folder: _includes
            Source: /home/users/kumar.saurabh/www/html/symfony_projects/UVdeskDocs/uvdocs
       Destination: /home/users/kumar.saurabh/www/html/symfony_projects/UVdeskDocs/uvdocs/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
Invalid theme folder: _layouts
Invalid theme folder: assets
       Jekyll Feed: Generating feed for posts
     Build Warning: Layout 'page-sidebar-layout' requested in _posts/2019-05-09-welcome-to-jekyll.markdown does not exist.
     Build Warning: Layout 'page-sidebar-layout' requested in 404.html does not exist.
     Build Warning: Layout 'page-sidebar-layout' requested in about.md does not exist.
     Build Warning: Layout 'page-sidebar-layout' requested in index.md does not exist.
                    done in 0.179 seconds.

I have one more question:

When I extracted the .gem file, I got 'data' folder in which _layouts, _includes and _sass folders are present but not the assets folder although I have added 'assets' folder while making .gem file. why?

I have followed the following tuturial: https://www.chrisanthropic.com/blog/2016/creating-gem-based-themes-for-jekyll/

Upvotes: 2

Views: 2002

Answers (1)

ashmaroli
ashmaroli

Reputation: 5444

First of all, you have confused yourselves with the technicalities of a jekyll theme-gem and using a local version.

  1. You need not create a theme-gem if you do not plan to share the theme with rest of the Jekyll community.
  2. When using path: attribute in a Gemfile, you need not generate a xyz.gem archive. Just a valid xyz.gemspec file is sufficient.

So ideally, your directory structure should simply be:

north/
  north.gemspec
  _layouts/
    layoutA.html
    layoutB.html
  _includes/
    lorem.html
    ipsum.html
  _sass/
    foo.scss
    bar.scss
  assets/
    styles.scss
docs/
  Gemfile
  index.md

then reference the theme-gem in your Gemfile:

gem 'north', path: '../north'

although I have added 'assets' folder while making .gem file.

The error is in your gemspec:

f.match(%r{^(_(includes|layouts|sass)/|(LICENSE|README)((\.(txt|md|markdown)|$)))}i)

There is no mention of assets in the regular-expression above.

You may want to refer the repositories for existing themes like minima for proper direction.

Upvotes: 1

Related Questions