Merge pull request #447 from ZeusWPI/revert-409-gitmetadata
Revert "added helper function to get modification time from git"
This commit is contained in:
commit
40c205e028
3 changed files with 5 additions and 20 deletions
|
@ -9,7 +9,7 @@
|
||||||
<meta name="twitter:label1" value="Author" />
|
<meta name="twitter:label1" value="Author" />
|
||||||
<meta name="twitter:data1" value="<%= @item[:author] %>" />
|
<meta name="twitter:data1" value="<%= @item[:author] %>" />
|
||||||
<meta name="twitter:label2" value="Created at" />
|
<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" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
|
|
||||||
<!-- Animate.css -->
|
<!-- Animate.css -->
|
||||||
|
@ -31,8 +31,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<div class="details animated fadeInRight">
|
<div class="details animated fadeInRight">
|
||||||
<small>
|
<small>
|
||||||
Geschreven op <%= gitctime %><br>
|
Geschreven op <%= item[:created_at] %><br>
|
||||||
Laatst aangepast op <%= gitmtime %><br>
|
|
||||||
Leestijd: <%= reading_time @item %>
|
Leestijd: <%= reading_time @item %>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -25,20 +25,4 @@ module BlogHelper
|
||||||
</figure>
|
</figure>
|
||||||
HTML
|
HTML
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -52,10 +52,12 @@ module PreprocessHelper
|
||||||
|
|
||||||
def update_blog_attributes
|
def update_blog_attributes
|
||||||
@items.find_all('/blog/**/*.md').each do |i|
|
@items.find_all('/blog/**/*.md').each do |i|
|
||||||
|
raise "#{i.identifier} doesn't have 'created_at'" unless i[:created_at]
|
||||||
i.update_attributes(
|
i.update_attributes(
|
||||||
# Tag all posts with article (for Blogging helper)
|
# Tag all posts with article (for Blogging helper)
|
||||||
kind: 'article',
|
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
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue