added 'laast aangepast' AND 'geschreven op'

This commit is contained in:
Jens Timmerman 2020-10-13 00:37:54 +02:00
parent 4292cb42a7
commit 0fa066fb1b
2 changed files with 10 additions and 0 deletions

View file

@ -28,6 +28,7 @@
<% end %> <% end %>
<div class="details animated fadeInRight"> <div class="details animated fadeInRight">
<small> <small>
Geschreven op <%= gitctime %><br>
Laatst aangepast op <%= gitmtime %><br> Laatst aangepast op <%= gitmtime %><br>
Leestijd: <%= reading_time @item %> Leestijd: <%= reading_time @item %>
</small> </small>

View file

@ -26,10 +26,19 @@ module BlogHelper
HTML HTML
end end
def gitctime
# find file last modification time
filepath=@item[:content_filename]
str=`git log --format=%cd --date=short -- #{filepath} | tail -1`
return Date.parse(str)
end
def gitmtime def gitmtime
# find file last modification time # find file last modification time
filepath=@item[:content_filename] filepath=@item[:content_filename]
str=`git log -1 --format=%cd --date=short -- #{filepath}` str=`git log -1 --format=%cd --date=short -- #{filepath}`
return Date.parse(str) return Date.parse(str)
end end
end end