模板引擎
简介
Liquid 基础语法
Liquid 内置方法
友好速搭主题对象
- 简介
 - shop
 - linklists
 - link
 - customer
 - customer_level
 - order
 - payment
 - shipment
 - line_item
 - tracker
 - discount_record
 - refund_record
 - address
 - area
 - product
 - image
 - variant
 - type
 - vendor
 - discount
 - discount_off
 - page
 - page_snippet
 - search
 - pagination
 - part
 - situation
 - item
 - sort
 - stock_avail
 - form
 - blog
 - blog_author
 - blog_tag
 - social_account
 - post
 - post_tag
 - post_dir
 
post
对象post用于显示文章。
可以调用post对象的页面:
| 页面 | 路径 | 对象 | 主题文件 | 
|---|---|---|---|
| 文章列表 | /posts | posts | 查看 | 
| 文章详情页面 | /posts/[handle] | post | 查看 | 
- post.handle
 - post.publish_at
 - post.content
 - post.tags
 - post.dirs
 - post.cover_image
 - post.summary
 - post.page_url
 - post.page_title
 - post.page_desc
 - previous_post_url
 - next_post_url
 
post.handle
String 类型,文章的唯一标识,例如x000001。
post.publish_at
文章发布时间,可以使用 date 方法格式化显示。
post.content
文章富文本内容。
post.title
文章标题。
post.tags
数组类型,文章的标签,元素是post_tag对象,使用方法查看 post_tag 对象。
post.dirs
数组类型,文章的目录,元素是post_dir对象,使用方法查看 post_dir 对象。
post.cover_image
文章封面图片,使用方法参见 image 对象。
post.summary
文章简介。
post.page_url
文章链接地址。
post.page_title
文章页面标题,用于SEO优化。
post.page_desc
文章页面描述,用于 SEO 优化。
previous_post_url
当前文章的上一篇路径(默认排序),需要结合post.handle使用
输入:
<!-- 假设当前文章详情页内容对象为 post -->
{{ post.handle | previous_post_url }}
输出:
/posts/x000020
next_post_url
当前文章的下一篇路径(默认排序),需要结合post.handle使用
输入:
<!-- 假设当前文章详情页内容对象为 post -->
{{ post.handle | next_post_url }}
输出:
/posts/x000018