【问题标题】:Can't get my gem based theme to work. Theme can't find layouts无法让我的基于 gem 的主题正常工作。主题找不到布局
【发布时间】:2017-04-04 08:30:54
【问题描述】:

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

我是红宝石宝石的新手,所以我认为我在创建宝石时做错了。我还使用默认的基于 Minima gem 的主题测试了我的 GitLab Pages 站点,当我切换到该主题或 Minimal Mistakes(也基于 gem)时它可以工作。但是,当我尝试添加自己的主题 (forty_jekyll_theme) 时,这些错误会显示在构建中,构建成功,并且我的站点的代码输出只是 index.md。 <head> 或其他任何内容都没有。

谁能告诉我我做错了什么?

谢谢

【问题讨论】:

  • 你能分享你的.gitlab-ci.yml文件吗?如果它是开源的,还有 repo。
  • post 布局正在由_posts/ 中的文件请求,您需要_layouts/post.html 中的文件。 home 布局也是如此。
  • 如果您没有看到我的最后评论,我删除了我的答案以避免混淆,因为这个问题似乎与我最初的想法不同。对不起,伙计,但祝你好运!

标签: ruby rubygems jekyll gitlab gitlab-ci


【解决方案1】:

当我忘记指定我在 _config.yml 中使用的 gem 主题时,我遇到了同样的错误。

例如,要使用您的主题 jekyll-custom-theme,您需要在文件中添加 theme 属性:

... # your _config.yml configurations

theme: jekyll-custom-theme # Specify the gem theme

确保在您的Gemfile 中也有当前版本的主题宝石,例如:

source "https://rubygems.org"
gem 'jekyll-custom-theme', '~> 0.0.1'

【讨论】:

    猜你喜欢
    • 2018-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-14
    • 1970-01-01
    相关资源
    最近更新 更多