From abd5257e4821298fa3e8cb646d93bfb4726356ba Mon Sep 17 00:00:00 2001 From: Maxime <12089026+mcbloch@users.noreply.github.com> Date: Thu, 18 Mar 2021 11:24:00 +0100 Subject: [PATCH] Revert "added helper function to get modification time from git" --- layouts/blogpost.erb | 5 ++--- lib/helpers/blog.rb | 16 ---------------- lib/helpers/preprocess.rb | 4 +++- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/layouts/blogpost.erb b/layouts/blogpost.erb index fedb926..0c4253c 100644 --- a/layouts/blogpost.erb +++ b/layouts/blogpost.erb @@ -9,7 +9,7 @@ - + @@ -31,8 +31,7 @@ <% end %>
- Geschreven op <%= gitctime %>
- Laatst aangepast op <%= gitmtime %>
+ Geschreven op <%= item[:created_at] %>
Leestijd: <%= reading_time @item %>
diff --git a/lib/helpers/blog.rb b/lib/helpers/blog.rb index 55b932b..96db131 100644 --- a/lib/helpers/blog.rb +++ b/lib/helpers/blog.rb @@ -25,20 +25,4 @@ 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 diff --git a/lib/helpers/preprocess.rb b/lib/helpers/preprocess.rb index dd3f3bb..6c787de 100644 --- a/lib/helpers/preprocess.rb +++ b/lib/helpers/preprocess.rb @@ -52,10 +52,12 @@ module PreprocessHelper def update_blog_attributes @items.find_all('/blog/**/*.md').each do |i| + raise "#{i.identifier} doesn't have 'created_at'" unless i[:created_at] i.update_attributes( # Tag all posts with article (for Blogging helper) kind: 'article', - academic_year: i.identifier.to_s[/\d\d-\d\d/], + academic_year: i.identifier.to_s[/\d-\d/], + created_at: Date.parse(i[:created_at]) ) end end