no more errors when a blog has no created_at line, parse str as date instead of datetime
This commit is contained in:
parent
804c0b1038
commit
4292cb42a7
2 changed files with 2 additions and 8 deletions
|
@ -30,10 +30,6 @@ module BlogHelper
|
|||
# find file last modification time
|
||||
filepath=@item[:content_filename]
|
||||
str=`git log -1 --format=%cd --date=short -- #{filepath}`
|
||||
if str == ""
|
||||
return @item[:created_at]
|
||||
else
|
||||
return str
|
||||
end
|
||||
return Date.parse(str)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,12 +52,10 @@ 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/],
|
||||
created_at: Date.parse(i[:created_at])
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue