Ruby Github页面上的Jekyll部署不';t格式正确,链接断开
我最近正在学习如何使用Jekyll和Github,我很难让我的网站在线正确显示,但当我运行时,它确实在本地正确显示:Ruby Github页面上的Jekyll部署不';t格式正确,链接断开,ruby,jekyll,liquid,github-pages,Ruby,Jekyll,Liquid,Github Pages,我最近正在学习如何使用Jekyll和Github,我很难让我的网站在线正确显示,但当我运行时,它确实在本地正确显示: jekyll serve --baseurl '' 我正在处理的Github回购协议是 任何帮助或提示都会非常有用 编辑:基本上整个网站缺少正确的CSS和链接指向错误的地方;特别是第一个主页和关于链接,因为任何其他链接都只是为了测试 Myconfig.yml: name: kingwizard description: wizardly blog paginate: 5 u
jekyll serve --baseurl ''
我正在处理的Github回购协议是
任何帮助或提示都会非常有用
编辑:基本上整个网站缺少正确的CSS和链接指向错误的地方;特别是第一个主页和关于链接,因为任何其他链接都只是为了测试
Myconfig.yml:
name: kingwizard
description: wizardly blog
paginate: 5
url: "http://yungkickz.github.io"
baseurl: /kingwizard
markdown: rdiscount
在这里,我还添加了html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{{ site.description }}">
<meta name="author" content="">
<title>{{ site.name }}</title>
<!-- Bootstrap core CSS -->
<link href="{{ site.baseurl }}/css/bootstrap.css" rel="stylesheet">
<!-- Custom Arreis Style -->
<link href="{{ site.baseurl }}/css/custom-style.css" rel="stylesheet">
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="{{ site.baseurl}}js/html5shiv.js"></script>
<script src="{{ site.baseurl}}js/respond.min.js"></script>
<![endif]-->
</head>
{{site.name}
从的源代码来看,我注意到了一些问题:
/
开头。似乎出于某种原因,GitHub上的site.baseurl
被设置为/
,尽管配置文件中有此设置。但是,您经常在路径中的site.baseurl
之后添加附加斜杠,这会导致出现第二个斜杠site.baseurl
是/
,浏览者希望在http://yungkickz.github.io/SOME_PATH
。但是,您的站点实际上已部署到http://yungkickz.github.io/kingwizard
,因此您的链接应该指向http://yungkickz.github.io/kingwizard/SOME_PATH
<link href="{{ site.baseurl }}/css/bootstrap.css" rel="stylesheet">
<link href="/kingwizard/css/bootstrap.css" rel="stylesheet">
之后:
<link href="{{ site.baseurl }}/css/bootstrap.css" rel="stylesheet">
<link href="/kingwizard/css/bootstrap.css" rel="stylesheet">
谢谢,在我的header.html中,它基本上看起来像你的“Before”,但我应该在代码中的每个点分别更改路径吗?我以为site.baseurl
会动态地为我做这部分,这样我就不必这么做了。我很抱歉,但我真的是新手,但真正感谢你的帮助!不过,我发现了site.baseurl
的问题,所以您应该仍然使用它。当我在本地运行jekyllservice--baseurl'
时,我注意到输出的第一行是配置文件:none
。事实证明,jekyll(本地和GitHub上)没有加载您的配置文件,因为它的名称是config.yml
,而不是\u config.yml
(应该是什么)。很好的发现!非常感谢。(菜鸟错误)这肯定修复了CSS问题和许多其他错误!您是如何注意到配置文件:none
的,因为我在终端中运行jekyll时没有看到它。我不确定,我运行了与您相同的jekyll命令,我看到了它。也许我们用的是不同版本的杰基尔。顺便说一下,我注意到您提交了\u站点
目录。您可能希望删除它并将其添加到.gitignore
。gitignore
我假设将忽略该目录,但我为什么希望发生这种情况?我会在网上搜索,但我想我会问你的