added helper function to get modification time from git
This commit is contained in:
parent
fab45a4e57
commit
4b4a938d7b
2 changed files with 12 additions and 1 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="<%= @item[:created_at] %>" />
|
<meta name="twitter:data2" value="<%= gitmtime item %>" />
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
|
|
||||||
<!-- Animate.css -->
|
<!-- Animate.css -->
|
||||||
|
|
|
@ -25,4 +25,15 @@ module BlogHelper
|
||||||
</figure>
|
</figure>
|
||||||
HTML
|
HTML
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def gitmtime
|
||||||
|
# find file extension
|
||||||
|
filepath=@item[:content_filename]
|
||||||
|
str=`git log -1 --format='%ci' -- #{filepath}`
|
||||||
|
if str == ""
|
||||||
|
return @item[:created_at]
|
||||||
|
else
|
||||||
|
return DateTime.parse( str )
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue