ppoffice / hexo-theme-icarus

A simple, delicate, and modern theme for the static site generator Hexo.
https://ppoffice.github.io/hexo-theme-icarus/
MIT License
6.28k stars 1.54k forks source link

配置中`update_time`设为`auto`后显示的更新时间为构建时间 #1233

Closed stydxm closed 2 months ago

stydxm commented 10 months ago

Bug描述 简洁清晰地描述你遇到的Bug是什么。 根据文档update_time设为auto,但构建后发现无论是否有过更新,首页和文章页均显示更新日期且为构建时间 目前我的博客就是这样的情况

系统与环境 列出你的Hexo和Icarus的版本和配置。

复现方式 update_time设为auto并进行构建

期望行为 文章的更新时间与发布时间相同时隐藏更新时间,不同时显示发布时间与更新时间而非构建时间

截图 SI%X0JF01{0U0N0}0C)%9(Y 8D`L%JQVPA~@J%H6RU9M(TK J%`2R(BY)AE5FZDXD0HS)RJ

ppoffice commented 10 months ago

这种情况下需要手动设置created_at

stydxm commented 10 months ago

这种情况下需要手动设置created_at

能否在文档里详细写下

stydxm commented 9 months ago

这种情况下需要手动设置created_at

实际效果与文档描述不同也可以算非预期行为吧

rinscr3003 commented 7 months ago

关键是很难自动的保存你的“书写完成时间”。对操作系统来说是知道文件修改时间的,但是这是文件系统的属性,上传到CI后还有没有是一个问题,CI的时区和作者的时区在不在一起也是一个问题。我曾用过一个主题,它用了CI的时区为当前时区。。。。结果是我刚刚更新的文章也给我显示多少小时前更新。。。这种情况最好还是自己手动去填写一下created_at比较好,即使有些主题这个时区问题一言难尽。

stydxm commented 7 months ago

关键是很难自动的保存你的“书写完成时间”。对操作系统来说是知道文件修改时间的,但是这是文件系统的属性,上传到CI后还有没有是一个问题,CI的时区和作者的时区在不在一起也是一个问题。我曾用过一个主题,它用了CI的时区为当前时区。。。。结果是我刚刚更新的文章也给我显示多少小时前更新。。。这种情况最好还是自己手动去填写一下created_at比较好,即使有些主题这个时区问题一言难尽。

可是我按照文档写了timeupdated这两个字段

stydxm commented 4 months ago

这个问题挺烦的,每篇文章手动指定dateupdated,但构建出来页面的更新时间还是构建的时间,希望可以修复下 @ppoffice

stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

PJ-568 commented 2 months ago

您可尝试用 Actions 生成文件后再用 cf 部署,同时您可能需要将 fetch 深度设置为 0 再尝试恢复文件时间:

# 以上省略
    steps:
    - name: Checkout source
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
        submodules: true

    - name: Setup Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '14.17.0'

    - name: Restore file modification time
      run: |
        git ls-files -z | while read -d '' path; do touch -d "$(git log -1 --format="@%ct" "$path")" "$path"; done

    - name: Install dependencies & Generate static files
      run: |
        node -v
        npm i -g hexo-cli
        npm i
        hexo clean
        hexo g
        hexo d

# 以下忽略,部署到 cf
stydxm commented 2 months ago

您可尝试用 Actions 生成文件后再用 cf 部署,同时您可能需要将 fetch 深度设置为 0 再尝试恢复文件时间:

好的,谢谢!