【发布时间】:2016-04-25 02:20:47
【问题描述】:
来自 Jekyll docs 它说(使用 .md 格式):
也可以使用
permalinkfront matter 变量来实现干净的 URL。在上面的示例中,使用第一种方法,您可以通过在文件顶部设置以下内容来获取文件other.md的 URLhttp://example.com/other:permalink: /other
这是我的页面前端问题的示例:
---
layout: page
title: Contact
permalink: /contact
---
当我使用jekyll serve 时一切正常,但是当我使用build 并上传到我的静态主机时它不起作用。 Jekyll 输出的文件结构对于它从文档中声明的功能没有意义。
.
|-- css/
|-- index.html # => http://example.com/
└── contact.md # => http://example.com/contact.html
我希望能够转到http://example.com/contact 并让它显示contact.md。我知道我可以通过手动将我的文件放入文件夹中(然后将它们全部重命名为index.html)来获得类似的功能,就像它在文档here 中所说的那样,但我不想经历额外的步骤和我不喜欢尾随/ 例如http://example.com/other/.
我正在使用Jekyll 3.0.1
我发现了这些问题,但它们并没有解决我面临的问题。
How to link to a page with page.url without the html extension in Jekyll?
How to make all posts have a permalink with custom format "domain.com/blog/title"?
【问题讨论】:
-
你试过这个解决方案了吗?在
_config.yml中有permalinks: /:title,看起来与我之前的答案类似:stackoverflow.com/questions/31791004/… 如果它有效,我会发布一个答案:) 我的网站设置类似于你想要的,其中一个文件夹@ 987654344@ 将在文件夹中创建,里面是一个index.html
标签: jekyll