美文网首页
hexo添加文章更新时间

hexo添加文章更新时间

作者: 甘芝林 | 来源:发表于2018-01-19 01:22 被阅读0次
    • 修改(博客主目录)/themes/next/layout/_macro/post.swig 文件,在<span class="post-time">...</span>标签后添加
    {%if post.updated and post.updated > post.date%}
      <span class="post-updated">
        &nbsp; | &nbsp; {{ __('post.updated') }}
        <time itemprop="dateUpdated" datetime="{{ moment(post.updated).format() }}" content="{{ date(post.updated, config.date_format) }}">
          {{ date(post.updated, config.date_format) }}
        </time>
      </span>
    {% endif %}
    
    • 根据博客配置文件中的 language 参数修改对应的语言配置文件(博客主目录)/themes/next/languages/zh_Hans.yml
    post:
      updated: 更新于
    
    • 修改主题配置文件(博客主目录)/themes/next/_config.yml,增加一行
    display_updated: true
    
    • 写文章的时候可以直接在文章开头设置更新时间
    updated: 2018-01-01 12:00:00
    
    • 没有这参数的话将会显示md文件的修改日期

    相关文章

      网友评论

          本文标题:hexo添加文章更新时间

          本文链接:https://www.haomeiwen.com/subject/etzgoxtx.html