gjtorikian / jekyll-last-modified-at

A Jekyll plugin to show the last_modified_at time of a post.
MIT License
243 stars 39 forks source link

Unix time for static files (rather than Git time) #33

Closed pathawks closed 9 years ago

pathawks commented 9 years ago

It seems that, for pages and posts, the modified time is when they were committed to the Git repo.

Unless I am misunderstanding somethinh, it seems that for static files the modified time is what the file system has stored rather than when it was committed to the repo. Is there a reason for this?

Have I done something wrong? (Quite likely)

gjtorikian commented 9 years ago

The modified time should be used if and only if information cannot be ascertained from the Git repo on when it was committed. Are you using the plugin in a Git repo?

pathawks commented 9 years ago

Are you using the plugin in a Git repo?

Yup.

Here is what I am looking at: https://travis-ci.org/jekyll/jekyll-sitemap/jobs/47481786

http://example.org/jekyll-last-modified-at/static-file.html was created in the same commit as http://example.org/2015/01/18/jekyll-last-modified-at.html and http://example.org/jekyll-last-modified-at/page.html, but the latter two display the date they were committed while the former displays the file system modified date (which will always be different on Travis).

gjtorikian commented 9 years ago

It looks like jekyll-last-modified-at/static-file.html does not have frontmatter associated with it, whereas the other two do. I wonder if that would affect things here. /cc @parkr Any thoughts here?

pathawks commented 9 years ago

Right; it is a static file, rather than a page. Jekyll treats them differently.

parkr commented 9 years ago

Static files unfortunately do not have any of these same attributes. It would make sense to add a data Hash which is then used in to_liquid, but at the moment, that has not been implemented. :(

pathawks commented 9 years ago

My mistake, jekyll-last-modified-at ignores static files completely; it does not get the file system modified time.

It seems that this is the expected behavior, barring #34

Mea culpa.