发布永久链接未在GitHub Pages上的Jekyll中进行解析 [英] Post permalinks not being parsed in Jekyll on GitHub Pages

查看:104
本文介绍了发布永久链接未在GitHub Pages上的Jekyll中进行解析的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用Jekyll在GitHub Pages上创建了一个新站点.我正在使用以下形式的自定义永久链接格式:

I've created a new site at GitHub Pages, using Jekyll. I'm using a custom permalink format in the following form:

permalink: /:title

这是因为我已将博客从WordPress移至其他位置,并希望以前存在的链接能够继续工作.当我使用"jekyll serve"在本地运行服务器时,它可以正常工作-但是,一旦将其托管在GitHub Pages上,链接就无法正确解析,从而导致出现这样的标签:

This is because I've moved my blog over from WordPress and want previously existing links to continue working. When I run the server locally with "jekyll serve", it works fine - however, once it's hosted on GitHub Pages, the links don't get parsed correctly, leading to tags like this one:

<a class="post-link" href="/:title">Markdown and HTML</a>

更多信息-我正在使用一个自定义域,我的_config.yml包含:

Further information - I am using a custom domain, with my _config.yml containing:

url: http://domain.com

我的CNAME包含:

domain.com

有人能阐明为什么会发生这种情况吗?谢谢.

Could anyone shed some light on why this occurs? Thanks.

推荐答案

您正在尝试使用 Github页面运行Jekyll 2.4 时,它会中断:-(

You're trying to use a functionality that was implemented in Jekyll 2.5. As Github pages runs Jekyll 2.4, it breaks :-(

执行所需操作的唯一方法是在_config.yml文件中设置默认的永久链接.

The only way to do what you want is to set default permalink in you _config.yml file.

permalink: :title/

这篇关于发布永久链接未在GitHub Pages上的Jekyll中进行解析的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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