diff --git a/layouts/blogpost.erb b/layouts/blogpost.erb index 6584e92..b4d775a 100644 --- a/layouts/blogpost.erb +++ b/layouts/blogpost.erb @@ -28,6 +28,7 @@ <% end %>
+ Geschreven op <%= gitctime %>
Laatst aangepast op <%= gitmtime %>
Leestijd: <%= reading_time @item %>
diff --git a/lib/helpers/blog.rb b/lib/helpers/blog.rb index 4b8be72..55b932b 100644 --- a/lib/helpers/blog.rb +++ b/lib/helpers/blog.rb @@ -26,10 +26,19 @@ module BlogHelper HTML 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 # find file last modification time filepath=@item[:content_filename] str=`git log -1 --format=%cd --date=short -- #{filepath}` return Date.parse(str) end + + end