Skip to content

xcatliu/hexo-filter-date-from-git

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

hexo-filter-date-from-git

Read git log and overwrite the front-matter properties date and updated for each posts.

WARNING: This plugin will overwrite the front-matter, even if you manually set a date or updated in the front-matter.

A live site using this plugin: http://js-index.com/

And the GitHub repo for that site: https://github.com/xcatliu/js-index

Installation

$ npm install hexo-filter-date-from-git --save

Usage

The date property will be the date when the first time someone committed the post. Same result as:

git log --format="%ad" -- <file> | tail -1

The updated property will be the date when the last time someone committed the post. Same result as:

git log --format="%ad" -- <file> | tail -1

NOTICE: If you created a new file, before you committed the file, the date and updated will be the date when you run hexo command.

Options

Null

About

Read git log and overwrite the front-matter properties `date` and `updated` for each posts

Resources

Stars

Watchers

Forks

Packages

No packages published