杰基尔博客永久链接中断并产生"404 not found"

  • 本文关键字:found not 中断 链接 jekyll
  • 更新时间 :
  • 英文 :


我创建了一个小网站,有几个页面和几篇博客文章。它托管在我所在组织的服务器上,我将_site/目录的所有内容ftp’ed到网站的子目录中。因此,Jekyll网站位于http://myusername.foobar.foo/thiswebsite/.

在我的_config.yml 中

baseurl: "/thiswebsite"
url: "http:// myusername.foobar.foo"

现在,所有页面都会正确显示。但是博客文章没有。

在每个博客文章的YAML前面的内容:

permalink: /:title.html

然后我在index.html页面上生成了链接,链接到http://myusername.foobar.bar/blog-title.html上的博客文章,但实际的博客文章可以在http://myusername.foobar.bar/hiswebsite/blog-title.html上找到。因此,如果人们点击index.html上的链接,他们会看到404。

在index.html上我有:

{% for post in site.posts %}
  <h2><a href="{{ post.url }}">{{ post.title }}</a></h2>
  <blockquote>
  {{ post.excerpt }}
  </blockquote>
{% endfor %}

我本以为{{ post.url }}会自动为帖子插入正确的URL,但显然这并没有发生(

我哪里搞砸了?

Jekyll版本3.1.2

注意:http://后面的空白是故意的,因为StackExchange认为我在发布链接,这显然是不允许的。在我实际的markdown和html中,它们是正确的URL。

到收藏项目(post-are收藏项目)或页面的链接:

例如:<a href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>

<a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>

资源链接也是如此(图像、脚本、css…)

例如:<link rel="stylesheet" href="{{ "/css/main.css" | prepend: site.baseurl }}">

<script src="{{ site.baseurl }}/js/script.js"></script>

最新更新