php - 构建警告:index.md 中请求的布局“XXX-layout”在 Jekyll 中不存在?
问题描述
我使用我自己创建的名为“north”的 Jekyll 创建了自己的主题。
创建主题后,我得到了一个名为“north-0.1.0.gem”的 gem 文件和一个名为“north.gemspec”的 gemspec 文件。
我将这两个文件都粘贴到新项目“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
索引.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
---
宝石文件
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 文件时,我得到了 'data' 文件夹,其中存在 _layouts、_includes 和 _sass 文件夹,但没有 assets 文件夹,尽管我在制作 .gem 文件时添加了 'assets' 文件夹。为什么?
我遵循了以下教程: https ://www.chrisanthropic.com/blog/2016/creating-gem-based-themes-for-jekyll/
解决方案
首先,您对 jekyll 主题宝石的技术性和使用本地版本感到困惑。
- 如果您不打算与 Jekyll 社区的其他成员共享主题,则无需创建主题宝石。
- 在 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 中引用 theme-gem:
gem 'north', path: '../north'
虽然我在制作 .gem 文件时添加了“资产”文件夹。
错误在您的 gemspec 中:
f.match(%r{^(_(includes|layouts|sass)/|(LICENSE|README)((\.(txt|md|markdown)|$)))}i)
assets
上面的正则表达式中没有提及。
您可能希望参考现有主题的存储库,例如minima
正确的方向。
推荐阅读
- autolayout - 为什么这个 AutoLayout 没有像人们期望的那样更新?
- r - 将 geom_point 添加到 R 中的特定行
- python - 用额外的括号在python中调用对象
- json - 从 kinesis firehose 解析 json
- c# - 无法使用 SendMessage 获取复选框/单选按钮状态
- android - Too much of words make the words go out of the screen
- windows - Visual Studio 可以编译项目,但是在 cli 中,msbuild 显示 MSB4019 错误
- oracle - 将返回的记录数存储到变量中
- python - Is it pythonic to have separate files instead of classes?
- python - TensorFlow 会话无法启动!Cuda 虚拟环境