简体   繁体   English

我需要为 Github 页面构建 Jekyll 吗?

[英]Do I need to build Jekyll for Github pages?

I'm working on a github pages workflow to help some non-techs update our website.我正在研究 github pages 工作流,以帮助一些非技术人员更新我们的网站。

So far, I've been running jekyll build locally and then deploying the resulting folder to github pages, which works swimmingly.到目前为止,我一直在本地运行jekyll build ,然后将生成的文件夹部署到 github 页面,这很好地工作。

On some review, it seems that much of the documentation implies that it should be possible to deploy just the Jekyll source files and have github automatically build the site and host it.在某些审查中,似乎大部分文档都暗示应该可以仅部署 Jekyll 源文件并让 github 自动构建站点并托管它。

Is this possible, and if so, why can't I get it to work?这是可能的,如果是这样,为什么我不能让它工作?

I've tried adding a new file to the _posts directory, and it seems that the 'Environment' tab of my repo shows that a build occurred, but the new post never shows up on the site.我尝试向 _posts 目录添加一个新文件,似乎我的 repo 的“环境”选项卡显示发生了构建,但新帖子从未出现在网站上。

Any suggestions would be HUGELY appreciated!任何建议将非常感激!

Thanks, Alex谢谢,亚历克斯

If your repository is named <USERNAME>.github.io then you can only use the master branch as the publishing source.如果您的存储库名为<USERNAME>.github.io那么您只能使用master分支作为发布源。 For repositories named anything else you can use gh-pages , master or /docs on master .对于命名为其他任何内容的存储库,您可以在master上使用gh-pagesmaster/docs

In the case of any of these, you can push your source up to your repository on GitHub.com which will automatically trigger a build of your site.对于其中任何一种情况,您都可以将源代码推送到 GitHub.com 上的存储库,这将自动触发站点的构建。

So it turns out the answer is that you can use jekyll source code, but only if it's in the gh-pages branch.所以答案是你可以使用 jekyll 源代码,但前提是它在 gh-pages 分支中。 If you use the docs/ folder or the master branch, it seems that you need to build locally before pushing (these options just allow you to host compiled HTML files rather than the raw jekyll source files).如果您使用 docs/ 文件夹或 master 分支,则似乎需要在推送之前在本地构建(这些选项仅允许您托管已编译的 HTML 文件而不是原始的 jekyll 源文件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM