如何定制Jekyll的url?
我想用Jekyll创build一个网站。 不是博客。 有没有办法避免在URL中和页面的文件名中指定创builddate?
我认为,Jekyll背后的想法是非常出色的,但是它似乎与博客生成内容紧密相关,而且在一个更普遍的用例中也可能是有用的。
在_config文件中,您可以将固定链接更改为您喜欢的任何内容,例如我的
permalink: /blog/:title 至于date,你可以select自己的date使用YAML前端的问题,再次在我的我
 title: example date: you can pick what ever date you want 
如果您不生成博客页面,则可以在目录结构中创build文件以映射到某些URL。 在本地主机上运行,如果你的目录有结构
 - _layouts/ - config.yml - index.html - some_other_page.html - some_directory/ - index.html - some_sub_page.html 
在jekyll处理完文件后,您将在以下位置获得内容:
-   0.0.0.0:4000)
-   0.0.0.0:4000/some_other_page.html)
-   0.0.0.0:4000/some_directory/ index.html)
-   0.0.0.0:4000/some_directory/some_sub_page.html/ some_sub_page.html)
你也可以在每个post上使用permalink属性来手动设置一个属性,或者在config.yml中设置一个不同的默认值。Permalinks只有一小部分variables可以使用,需要在你想放入的每个文件中定义非标准的位置。
这个目录结构也会自动分类你的post。 所以你可以有:
 - some_category (defined in the yaml front matter or the _config.yml - index.html - _posts/ - some_post.md - some_other_post.md 
 post将自动具有“某个类别”类别,index.html将显示在0.0.0.0:4000/some-category ,默认的永久链接格式。 类别variables可用于:category永久链接格式string中的:category 。 
 我遇到了这个老问题,同时寻找一种方法来组织一个_pages目录中的_posts 页面 ,类似于_posts 。 然后访问此页面,而不显示在URL中的整个path。 
对我更好的方法是使用jekyll集合如下:
  1  – 在_config.yml添加一个页面集合: 
 collections: pages: output: true permalink: /:path/ 
  2  – 创build一个名为_pages的新目录(它应该有相同的集合名称,前缀为_ ) 
  3  – 将_pages文件夹中的页面添加为以YAML Front Matter开头的.md或.html文件。 
 例如。  /_pages/about.md将如下所示: 
 --- layout: page --- <!-- about page content --> 
 在build立之后,关于页面的URL将是<your-web-site>/about 。 
或者,要显示集合名称,您必须将其永久链接定义为:
 permalink: /:collection/:path/ 
什么文档说:
您在_config.yml文件中configuration永久链接,如下所示:
permalink: /:categories/:year/:month/:day/:title.html如果你没有指定任何永久链接设置,Jekyll将使用上面的模式作为默认设置。 永久链接也可以使用内置的永久链接样式进行设置:
permalink: date尽pipe您可以使用模板variables指定自定义永久链接模式,但为了方便起见,Jekyll还提供了以下内置样式。
- date = /:categories/:year/:month/:day/:title.html
- pretty = /:categories /:year /:month /:day /:title /
- ordinal = /:categories/:year/:y_day/:title.html
- none = /:categories/:title.html
来源: https : //jekyllrb.com/docs/permalinks/
我如何使用它:
 permalink: /blog/:title/ 
这将页面设置为漂亮的固定链接样式。 因此'/contact.md'将变成'/ contact /'。