tl; dr: jekyll-last-modified-at, a popular plugin to get the last modified time of a file for a Jekyll site, was causing slow generation times so I wrote a more performant (~70% time reduction for full site regen) alternative at https://github.com/klandergren/jekyll-last-commit, and you get commit info like author, date, and message.
I have a 1000+ page Jekyll-based site that was seeing slow generation time—on investigation I discovered the plugin jekyll-last-modified-at was spawning a new process _for every page_ to determine the last modified time (via git commit history). Even after using Jekyll's --incremental option—which has its own issues like needing `regenerate: true` in the front matter to regen on data changes—this was still too slow.
So to address I did two things:
1.) opened two PRs to improve performance, both referenced from this issue and available to try out: https://github.com/gjtorikian/jekyll-last-modified-at/issues.... these were done in the style of the existing codebase and basically just improved caching and switched the git invocation to a single bulk call
Implementation details available in both places! Up to you which approach works best for your setup.
Notes:
* this is only likely relevant to you if a) you want additional commit info beyond date or b) you have a very large Jekyll website (many 100s of pages that each need last modified date); for smaller sites the performance difference will likely be negligible
* performance will vary based on how many files you have and how frequently they change throughout the commit history
* the original PRs were done in 2021 and the plugin was written in December of 2022 when I wanted to play around with publishing a ruby gem
* this was a pretty quick project—if there are issues or errors please report them!
1 comment
[ 2.9 ms ] story [ 10.8 ms ] threadI have a 1000+ page Jekyll-based site that was seeing slow generation time—on investigation I discovered the plugin jekyll-last-modified-at was spawning a new process _for every page_ to determine the last modified time (via git commit history). Even after using Jekyll's --incremental option—which has its own issues like needing `regenerate: true` in the front matter to regen on data changes—this was still too slow.
So to address I did two things:
1.) opened two PRs to improve performance, both referenced from this issue and available to try out: https://github.com/gjtorikian/jekyll-last-modified-at/issues.... these were done in the style of the existing codebase and basically just improved caching and switched the git invocation to a single bulk call
2.) created a new plugin https://github.com/klandergren/jekyll-last-commit that uses libgit2 (via https://github.com/libgit2/rugged) to interrogate the git repository directly.
Implementation details available in both places! Up to you which approach works best for your setup.
Notes:
* this is only likely relevant to you if a) you want additional commit info beyond date or b) you have a very large Jekyll website (many 100s of pages that each need last modified date); for smaller sites the performance difference will likely be negligible
* performance will vary based on how many files you have and how frequently they change throughout the commit history
* the original PRs were done in 2021 and the plugin was written in December of 2022 when I wanted to play around with publishing a ruby gem
* this was a pretty quick project—if there are issues or errors please report them!