构建警告:index.md 中请求的布局'XXX-layout'在 Jekyll 中不存在?



我使用了我自己创建的'north'的jekyll创建了一个自己的主题。

创建主题后,我以" North-0.1.0.gem"和Gemspec文件为" North.gemspec"。

我将这两个文件都拿出在一个名为" north"的文件夹中的新项目'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         = ["kumar.saurabh108@abc.com"]
  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"

错误:

终端:

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.

我还有一个问题:

当我提取.gem文件时,我得到了"数据"文件夹,其中_layouts,_includes和_sass文件夹中存在,而不是资产文件夹,尽管我在制作.gem文件时添加了'Assets'文件夹。为什么?

我遵循以下略属:https://www.chrisanthropic.com/blog/2016/creating-gem-coreating-base--themes-for-jekyll/

首先,您已经将自己与jekyll主题游戏的技术相混淆并使用本地版本。

  1. 如果您不打算与Jekyll的其余部分共享主题,则无需创建主题游戏。
  2. 在Gemfile中使用path:属性时,您无需生成xyz.gem存档。只是有效的xyz.gemspec文件就足够了。

因此,理想情况下,您的目录结构应该只是:

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

然后在您的gemfile中引用主题 -

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

尽管我在制作.gem文件时添加了"资产"文件夹。

错误在您的宝石中:

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

上面的常规表达中没有提及assets

您可能需要转介现有主题(例如minima(的存储库。

相关内容

  • 没有找到相关文章

最新更新