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