ruby - 无法让我的基于 gem 的主题工作。主题找不到布局

标签 ruby rubygems jekyll gitlab gitlab-ci

我已经尝试通过谷歌搜索来解决这个问题,并按照各种说明创建我自己的基于 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/

相关文章:

ruby - 如何将找到的每个值映射到不同的变量

ruby - 使用 Sinatra 时如何从 gem 导入 rake 任务?

macos - Mac OS 10.14 Mojave + qt5.5 + gem capybara-webkit

jekyll - GitHub Pages Jekyll 模板存在问题

mysql - after_update 回调不会更新属性

ruby-on-rails - UserSession 真实性 token 正在不同用户之间共享

ruby - 传递函数作为最终参数

c - 如何让 ruby​​ mkmf 识别已修补的函数?

jekyll - 如何使用 jekyll 插件压缩和缩小资源

jekyll - 如何循环遍历 Jekyll 集合中的类别