Jekyll中的帖子和页面有什么区别? [英] What are the differences between a post and a page in Jekyll?
本文介绍了Jekyll中的帖子和页面有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Jekyll.帖子和页面之间有什么区别?据我所见:
I am using Jekyll. What are the differences between a post and a page? As far as I can see:
- 它们都可以包含YAML前端事物,并且
- 帖子有日期和固定链接,但页面没有.
还有更多区别吗?
推荐答案
以下是区别
- 帖子名称包含帖子的标题和日期.文件名中的日期无效会导致错误.
- 帖子是可比较的对象,这意味着可以比较两个帖子.比较是通过发布日期和发布信息来完成的.
- 生成的帖子和页面的默认相对URL不同(例如
/2000/01/01/my-post.html
和/about.html
). - 页面可以放置在任何地方,而帖子只能放置在
_posts
文件夹下. - 帖子具有更多开箱即用的数据,可用于Liquid模板(标题,URL,日期,ID,类别,下一个,上一个,标签,内容).
- 帖子具有唯一的ID.
- A post filename contains the title and the date of the post. An invalid date in the filename causes an error.
- Posts are comparable objects, which means two posts can be compared. The comparison is made by the post date and the post slugs.
- The generated default relative URL of a post and a page are different (e.g.
/2000/01/01/my-post.html
and/about.html
). - A page can be placed anywhere but a post can only be placed under
_posts
folder. - A post has more data out of the box for use in Liquid templates (title, URL, date, id, categories, next, previous, tags, content).
- A post has a unique id.
帖子代表博客帖子(因此可用于轻松创建博客帖子).页面代表网站页面.
A post represents a blog post (so it is used to easily create a blog post). A page represents a website page.
这篇关于Jekyll中的帖子和页面有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文