Merge pull request #447 from ZeusWPI/revert-409-gitmetadata

Revert "added helper function to get modification time from git"
This commit is contained in:
Maxime 2021-03-18 11:24:09 +01:00 committed by GitHub
commit 40c205e028
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 20 deletions

View file

@ -9,7 +9,7 @@
<meta name="twitter:label1" value="Author" />
<meta name="twitter:data1" value="<%= @item[:author] %>" />
<meta name="twitter:label2" value="Created at" />
<meta name="twitter:data2" value="<%= gitmtime %>" />
<meta name="twitter:data2" value="<%= @item[:created_at] %>" />
<meta name="twitter:card" content="summary_large_image" />
<!-- Animate.css -->
@ -31,8 +31,7 @@
<% end %>
<div class="details animated fadeInRight">
<small>
Geschreven op <%= gitctime %><br>
Laatst aangepast op <%= gitmtime %><br>
Geschreven op <%= item[:created_at] %><br>
Leestijd: <%= reading_time @item %>
</small>
</div>

View file

@ -25,20 +25,4 @@ module BlogHelper
</figure>
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

View file

@ -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