我已经尝试通过谷歌搜索来解决这个问题,并按照各种说明创建我自己的基于 gem 的主题,但它仍然对我不起作用。在它们成为基于 gem 之前,我已经创建了一堆 Jekyll 主题并且没有任何问题。
现在,当我尝试运行主题时,出现一堆错误:
Build Warning: Layout 'post' requested in _posts/2016-8-20-etiam.md does not exist.
Build Warning: Layout 'post' requested in _posts/2016-8-21-consequat.md does not exist.
Build Warning: Layout 'post' requested in _posts/2016-8-22-ipsum.md does not exist.
Build Warning: Layout 'post' requested in _posts/2016-8-23-magna.md does not exist.
Build Warning: Layout 'post' requested in _posts/2016-8-24-tempus.md does not exist.
Build Warning: Layout 'post' requested in _posts/2016-8-25-aliquam.md does not exist.
Build Warning: Layout 'home' requested in index.md does not exist.
我是 ruby gems 的新手,所以我认为我在创建 gem 时做错了什么。我还使用默认的基于 Minima gem 的主题测试了我的 GitLab Pages 站点,当我切换到该主题或 Minimal Mistakes(也是基于 gem)时它可以正常工作。但是,当我尝试添加自己的主题 (forty_jekyll_theme) 时,这些错误显示在构建中,构建成功,我站点的代码输出只是 index.md。 <head>
里面什么都没有或其他。
谁能告诉我我做错了什么?
谢谢
最佳答案
当我忘记在我的 _config.yml
中指定我使用的 gem 主题时,我遇到了同样的错误。
例如,要使用您的主题 jekyll-custom-theme
,您需要在文件中添加 theme
属性:
... # your _config.yml configurations
theme: jekyll-custom-theme # Specify the gem theme
请确保在您的 Gemfile
中也包含当前版本的主题 gem,例如:
source "https://rubygems.org"
gem 'jekyll-custom-theme', '~> 0.0.1'
关于ruby - 无法让我的基于 gem 的主题工作。主题找不到布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40711813/