【问题标题】:Why is my Jekyll blog not on my Github page?为什么我的 Jekyll 博客不在我的 Github 页面上?
【发布时间】:2016-02-21 19:46:51
【问题描述】:

http://leongaban.github.io/leongaban-10/

Here is my repo with a jekyll blog 100% 在本地工作,我确实创建了 gh-pages 分支。下面是我的 github 页面上的博客应该是什么样子的截图:

我需要在我的_config.yml 中更改任何内容吗?

网站设置

title: Leon Gaban
email: leongaban@gmail.com
description: "Leon Gaban"# this means to ignore newlines until "baseurl:"
baseurl: "" # the subpath of your site, e.g. /blog
url: "http://leongaban.com" # the base hostname & protocol for your site
twitter_username: leongaban
github_username:  leongaban

# Build settings
markdown: kramdown

【问题讨论】:

    标签: github jekyll github-pages


    【解决方案1】:

    您的存储库名称必须以 github.com/github.io 结尾,即将您的 https://github.com/leongaban/leongaban-10/ 存储库重命名为:https://github.com/leongaban/leongaban.github.io

    【讨论】:

    • 我还需要补充一点,我的 _site 文件夹没有被添加到 repo 中,它在 .gitignore 中列出,所以我必须从那里删除它,现在使用正确的路径和所有文件,它的工作! leongaban.github.com
    【解决方案2】:

    将此添加到您的_config.yml

    kramdown:
      input: GFM
    

    为了保持 GitHub 将使用的相同降价。

    另外,如果是您的用户网站username.github.io,最好将其移至master 分支。 gh-pages 分支应该只应用于项目网站。

    您的_site 文件夹不应该在那里。它包含已经构建的站点。通常它对本地预览很有用,当您使用不会自动构建 Jekyll 的服务(如 Apache 服务器)进行托管时。此外,当您使用 GitHub 不允许的 Jekyll 插件时,您会选择在本地构建站点并将静态站点仅上传到 GH。

    我看到两种方法:如果您删除 _site 文件夹并将您的项目移动到主分支,或者您删除其余内容并仅将 _site 文件夹的内容(而不是文件夹本身)上传到您的存储库)。

    希望有所帮助!

    【讨论】:

    • 哦,谢谢,不知道 _site 是如何工作的...所以这很酷,Jekyll 在 github 上编译
    • 没错。它是通过 bundle exec jekyll build 使用 bundler 构建的。
    • 我在手机上写得很快,所以我无法为您提供链接,但请尝试在谷歌上搜索“GitHub Pages Jekyll bundle exec”,您会发现 GH 文档解释那个。
    • 这里你会找到使用 bundler 的分步说明:stackoverflow.com/a/35449384/5455207
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 2015-11-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-26
    • 2013-04-07
    相关资源
    最近更新 更多