V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
xcatliu
V2EX  ›  程序员

撸了两个 Hexo 的 Plugins

  •  
  •   xcatliu ·
    xcatliu · 2016-07-01 18:59:47 +08:00 · 5782 次点击
    这是一个创建于 2853 天前的主题,其中的信息可能已经有所发展或是发生改变。

    都是从 git log 获取数据填充到 posts 中:

    hexo-filter-date-from-git

    • 获取 post 的第一个提交的 date 作为 front-matter 中的 date
    • 获取 post 的最后一个提交的 date 作为 front-matter 中的 updated

    解决的问题

    hexo 中如果没有在 front-matter 中指定 date,则会读取文件的创建日期和修改日期。 但是这个日期是不可靠的。如果重新 clone 一份代码,则所有文件的创建日期都变成了 clone 的时间。

    hexo-filter-author-from-git

    • 获取 post 的第一个提交的 user.name 作为 author
    • 获取 post 的所有提交的 user.name ,生成一个数组作为 contributors

    解决的问题

    手动维护一个 contributors 列表太麻烦了。

    1 条回复    2016-07-01 19:14:12 +08:00
    jrhu05
        1
    jrhu05  
       2016-07-01 19:14:12 +08:00 via iPhone
    bravo !有 hexo 专门节点哦,可以放到 hexo 节点。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2729 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:45 · PVG 23:45 · LAX 08:45 · JFK 11:45
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.