Jekyll语法

http://ju.outofmemory.cn/entry/149459  (Jekyll/Liquid API 语法文档)

https://www.jianshu.com/p/9f71e260925d

  • {% for post in paginator.posts %} {% endfor %}表示一个for循环,百分号之间的语句为要执行的语句,该段代码表示分页输出文章,分页数量在_config.yml中配置,注意:分页只在根目录下的index.html中有效

  • { site.自定义字段名称 } 表示获取_config.yml里面的自定义字段名称的值

  • {% for post in site.posts limit:2 %} {% endfor %}循环输出 2 篇文章

  • {% for post in site.posts offset:0 limit:2 %}循环输出最新2篇文章

  • {% for tag in post.tags %} {% endfor %}输出该篇文章里的tag

  • {% if link.type == site.blog_1 %} {% endfor %}字符串比较

  • | {% assign count = 0 %}****{% assign count = count | plus: 1 %}定义assign变量加1 |

  • {{post.content | strip_html | strip_newlines | truncate: 100 }}获取文章摘要,取前100个字符

  • 2018-02-10-你要添加的描述.markdown,文章命名格式,否则识别不了

  • {{ page.date | date: ‘%Y, %b %d’ }}输出文章日期

  • {{page.title}}输出文章标题

  • {% if post.jekyll %} 判断文章里的jekyll字段是否为true

  • {% if paginator.previous_page %}是否有上一页

  • {% if paginator.next_page %}是否有下一页

  • {{ paginator.previous_page_path }}上一页url

  • {{ paginator.next_page_path }}下一页url

  • | {{ post.url | prepend: site.baseurl }}要访问的文章的url |

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值