mirror of
https://github.com/inventree/inventree-website.git
synced 2025-04-27 04:56:45 +00:00
Add last modified to posts and repos
This commit is contained in:
parent
37a3e357c0
commit
2add4aeede
22
_plugins/hook-add-last-modified-date.rb
Normal file
22
_plugins/hook-add-last-modified-date.rb
Normal file
@ -0,0 +1,22 @@
|
||||
# see https://stackoverflow.com/a/36769049/17860466
|
||||
|
||||
Jekyll::Hooks.register :posts, :pre_render do |post|
|
||||
|
||||
# get the current post last modified time
|
||||
modification_time = File.mtime( post.path )
|
||||
|
||||
# inject modification_time in post's datas.
|
||||
post.data['last-modified-date'] = modification_time
|
||||
|
||||
end
|
||||
|
||||
|
||||
Jekyll::Hooks.register :repo, :pre_render do |repo|
|
||||
|
||||
# get the current post last modified time
|
||||
modification_time = File.mtime( repo.path )
|
||||
|
||||
# inject modification_time in post's datas.
|
||||
repo.data['last-modified-date'] = modification_time
|
||||
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user