问题描述
我正在将Jekyll用于博客/投资组合网站.我有几个帖子是投资组合条目,还有几个是博客条目.
I'm using Jekyll for a blog/portfolio site. I have several posts which are portfolio entries, and several which are blog entries.
我能够使用投资组合条目帖子来构建投资组合页面(www.alexmarchant.com/portfolio),但是Jekyll仍然为每个投资组合条目生成一个永久链接的个人页面.有什么办法可以关闭此功能吗?
I am able to use the portfolio-entry posts to build a portfolio page (www.alexmarchant.com/portfolio), but Jekyll still generates a permalinked individual page for each portfolio entry. Is there any way to turn this off?
我已经在帖子的YAML前沿部分尝试了以下内容:
I've tried the following in the YAML front-matter section of the posts:
- 永久链接:无
- 永久链接:false
都不行.
推荐答案
我发现了一个 hack 可以执行您想要的操作:将永久链接设置为已经存在的页面时,它将不会不会生成(原始页面会在其中),但仍可以在Jekyll中作为帖子/页面实体使用.
I found one hack to do what you want: when you set the permalink to be an already existent page, then it won't be generated (the original page would be there), but it still would be available as an post/page entity in Jekyll.
因此,如果您在以下URL上有一个投资组合的索引页:/portfolio/index.html
,然后在您的/_posts/
中,您将在YAML前线中找到任何带有此内容的帖子:permalink: /portfolio/index.html
,然后是页面将不会生成.
So, if you'd have an index page for portfolio at such url: /portfolio/index.html
, and then in your /_posts/
you would have any posts which would have this in YAML front matter: permalink: /portfolio/index.html
, then those pages wouldn't be generated.
这篇关于是否可以阻止Jekyll为每个帖子生成页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!