找不到Jekyll帖子 [英] Jekyll Posts Not found

查看:96
本文介绍了找不到Jekyll帖子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我设置了一个Jekyll页面,创建了一些演示文章,在它们之间进行了导航,并根据自己的喜好对其进行了样式设置,然后在根目录中设置了"jekyll".

So I setup a Jekyll page, I created a few demo posts, got a navigation between them working and styled it to my liking and then went 'jekyll' in the root.

这在我的根目录中生成了一个_site文件夹.惊人的.

This generated a _site folder in my root. Awesome.

但是,当我在浏览器中打开此文件夹并尝试在帖子之间导航时,它会尝试转到file:///2013/02/01/post-title.html而不是实际位置,即 file:///blablabla/_site/2013/02/01/post-title.html

But when I open this folder in browser, and try to navigate between posts, it attempts to go to file:///2013/02/01/post-title.html instead of the actual location, which would be file:///blablabla/_site/2013/02/01/post-title.html

我一直在看yml文件中的Permalinks选项,但是我还没有找到可行的解决方案.

I've been looking at Permalinks options in the yml-file, but I havent found a working solution yet.

我使用:

<a href="{{page.previous.url}}" title="Previous Post: {{page.previous.title}}">
{{page.previous.title}}</a>

要在帖子之间导航,并且:

To navigate between posts, and:

{% for post in site.posts limit: 5 %}
    <a href="{{ post.url }}">{{ post.title }}</a>
{% endfor %}

链接主页上的帖子.

从我的config.yml中:

From my config.yml:

baseurl:     /
url:         http://localhost:5000
source:      .
destination: ./_site
permalink:   /writing/

在这里有任何提示! 谢谢

Taking any hints here! Thanks

推荐答案

所以我所做的是:

在我的_config.yml中,我添加了以下内容:

In my _config.yml, I added this:

baseurl:     /
url:         http://some.link.he.re/~nameofdir/big_blog

对于CSS/JS之类的资产,我只需使用{{site.url}}来预先固定我的所有实际资产.:

And for assets like CSS/JS I simply used {{ site.url }} to pre-fix all my actual assets.:

<link href="{{ site.url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />

我做了导航:

<a href="**{{site.url}}**{{page.previous.url}}" title="Previous Post: 
{{page.previous.title}}"> {{page.previous.title}}</a> 

在我的post.html布局中,我添加了:在中,虽然我不确定这是否有必要,但目前仍会持续.

In my post.html layout, I added: in the , I am not sure if this is necessary though, but for now it will linger.

对于我添加的所有静态页面:

For all static pages I added:

<li><a href="**{{site.url}}**/journal.html">Journal</a></li>

最后,即使所有内容都是一样,用于链接帖子:

And finally, even though it's the same thing all over, for linking posts:

<a href="{{site.url}}{{post.url}}">{{ post.title }}</a>

所以{{site.url}}与您在_config.yml中以url:xxxx编写的内容相同, 而且,如果您将页面托管在具有奇数目录结构的服务器上(例如,例如我的大学),则需要提供url:实际根目录的值,这意味着最后要包含blog-folder-name网址中的文件夹.然后,只需为您所有由{{site.url}}生成的静态链接或jekyll链接添加前缀,您就应该很酷!

So {{ site.url }} is the same as what you write in _config.yml at url: xxxx, And if you're hosting your page on a server that has odd directory structure (like my university for example), you need to give url: the value of the actual root catalog, that means include the blog-folder-name as the last folder in the url. Then just prefix all your links, static or jekyll-generated by {{ site.url }} and you should be cool!

这篇关于找不到Jekyll帖子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆