如何将Jekyll博客托管到GitHub子目录?

4
我想在Github的主repo的子目录上使用Jekyll创建一个博客。目前,我在www.jonbstrong.com上有一个着陆页/作品集,希望在www.jonbstrong.com/blog上创建Jekyll博客。 Jekyll快速入门指南上的说明只涉及当您想要将博客安装在主repo中时。

我没有看到实际的问题被问到。你能详细说明一下你在问什么,以及你尝试过什么不起作用吗? - CodeMoose
2
我想问的是:如何在Github子目录上安装Jekyll博客? - jonbstrong
1个回答

1
只需创建一个 blog 存储库并将您的 Jekyll 文件发送到其中(gh-pages 分支)。然后,您将能够访问 www.jonbstrong.com/blog。
编辑: 用户/组织存储库发布在 master 分支中。任何其他存储库,例如 username.github.io/repositoryName,都会发布在 gh-pages 分支中。
git checkout -b gh-pages
git add -A
git commit -m "first commit in gh-pages branch"
git push origin gh-pages

完成。


我已经创建了一个博客存储库并在那里创建了一个jekyll博客,但是我不确定如何使用页面而不是主分支,并且无法使用www.jonbstrong.com/blog地址访问它。以下是我使用的完整命令列表:jekyll new myblog | cd myblog | jekyll serve | git init | git add -A | git commit -m“first commit”| git remote add origin | https://github.com/jonbstrong/blog.git | git push -u origin master - jonbstrong
非常感谢您的帮助!但是我现在在 http://jonbstrong.com/blog/ 上看到了一些相当奇怪的布局,似乎jekyll安装缺少样式或出了什么问题... - jonbstrong
1
在你的 _config.yml 文件中,你需要设置 baseurl: "/blog" - David Jacquel

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接