首页 > 解决方案 > Jekyll 找不到布局

问题描述

我正在使用 git page 制作一个 github 网站。我正在使用Academicpages/academicpages.github.io。我将此 repo 复制到我的 gitpage repo,并编辑了/_pages文件夹中的页面。但是当我使用 jekyll 构建网站时,我得到以下信息:

  Jekyll Feed: Generating feed for posts
 Build Warning: Layout 'single' requested in pages/about.md does not exist.
 Build Warning: Layout 'archive' requested in pages/dissertation.md does not exist.
 Build Warning: Layout 'archive' requested in pages/research.md does not exist.
 Build Warning: Layout 'archive' requested in pages/software does not exist.
 Build Warning: Layout 'archive' requested in pages/teaching.md does not exist.

我没有关注这个,因为在我制作的 git repo 中,我在_layouts文件夹中有布局。archive.html并且single.html都在里面。

那么可能导致问题的原因是什么?

一个问题是,我是否应该将所有这些文件放在硬盘上的 git 网站文件夹中?由于我分叉了主题 repo,所以文件都在我的 git repo 上,我的硬盘上没有布局文件。

标签: githubjekyll

解决方案


https://github.com/academicpages/academicpages.github.io中的文档

  1. 在本地运行(不在 GitHub Pages 上,在您自己的计算机上提供服务)
  2. 克隆存储库并进行更新,如上所述
  3. 确保安装了 ruby​​-dev、bundler 和 nodejs:sudo apt install ruby​​-dev ruby​​-bundler nodejs
  4. 运行 bundle clean 清理目录(无需运行 --force)
  5. 运行 bundle install 来安装 ruby​​ 依赖项。如果出现错误,请删除 Gemfile.lock 并重试。
  6. 运行 bundle exec jekyll liveserve 生成​​ HTML 并从 localhost:4000 提供它,本地服务器将在更改时自动重建和刷新页面。

所以,是的,基本上你克隆 repo 以在你的硬盘上拥有所有文件,然后安装依赖项,最后你在本地使用jekyll serveor启动你的站点jekyll serve -i


推荐阅读