github-pages - 用github pages 搭建博客的时候,博客怎么按时间添加的顺序排列?

查看:110
本文介绍了github-pages - 用github pages 搭建博客的时候,博客怎么按时间添加的顺序排列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

我需要让发表的博客按照时间顺序排列,就是新发表的文章排在文章列表的下面,应该怎么设置?

访问地址

源码

谢谢~~

解决方案

liquid模板里面支持反转list顺序,把 index.html 里面的for循环这么改:

{% for post in site.posts reversed %}
    <li class="title-li">
        <span class="write-time"># 发表于: {{ post.date | date_to_string }} </span>
        <a class="blog-title" href="{{ site.baseurl }}{{ post.url }}">{{ post.title }}</a>
    </li>
{% endfor %}

这篇关于github-pages - 用github pages 搭建博客的时候,博客怎么按时间添加的顺序排列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆