mirror of https://gitlab.com/curben/blog
style: parse date only, ignore time
This commit is contained in:
parent
8717b52283
commit
ab5161bbc8
|
@ -1,4 +1,4 @@
|
||||||
<a href="<%- url_for(post.path) %>" class="<%= class_name %>">
|
<a href="<%- url_for(post.path) %>" class="<%= class_name %>">
|
||||||
<%/* Date format is specified to skip timezone conversion */%>
|
<%/* Date format is specified to skip timezone conversion */%>
|
||||||
<time datetime="<%= date(post.date, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]') %>" itemprop="datePublished"><%= date(post.date, date_format) %></time>
|
<time datetime="<%= date(post.date, 'YYYY-MM-DD[T00:00:00.000Z]') %>" itemprop="datePublished"><%= date(post.date, date_format) %></time>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<%/* User-specified updated date */%>
|
<%/* User-specified updated date */%>
|
||||||
<%/* default post.updated is (almost) always is the time 'hexo generate' is executed */%>
|
<%/* default post.updated is (almost) always is the time 'hexo generate' is executed */%>
|
||||||
<a href="<%- url_for(post.path) %>" class="<%= class_name %>">
|
<a href="<%- url_for(post.path) %>" class="<%= class_name %>">
|
||||||
<time datetime="<%= date(post.lastUpdated, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]') %>" itemprop="dateUpdated"><%= date(post.lastUpdated, date_format) %></time>
|
<time datetime="<%= date(post.lastUpdated, 'YYYY-MM-DD[T00:00:00.000Z]') %>" itemprop="dateUpdated"><%= date(post.lastUpdated, date_format) %></time>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -121,14 +121,14 @@ function openGraphHelper (options = {}) {
|
||||||
if (published) {
|
if (published) {
|
||||||
if ((moment.isMoment(published) || moment.isDate(published)) && !isNaN(published.valueOf())) {
|
if ((moment.isMoment(published) || moment.isDate(published)) && !isNaN(published.valueOf())) {
|
||||||
// Skip timezone conversion
|
// Skip timezone conversion
|
||||||
result += og('article:published_time', moment(published).format('YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'))
|
result += og('article:published_time', moment(published).format('YYYY-MM-DD[T00:00:00.000Z]'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (updated) {
|
if (updated) {
|
||||||
if ((moment.isMoment(updated) || moment.isDate(updated)) && !isNaN(updated.valueOf())) {
|
if ((moment.isMoment(updated) || moment.isDate(updated)) && !isNaN(updated.valueOf())) {
|
||||||
result += og('article:modified_time', moment(updated).format('YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'))
|
result += og('article:modified_time', moment(updated).format('YYYY-MM-DD[T00:00:00.000Z]'))
|
||||||
result += og('og:updated_time', moment(updated).format('YYYY-MM-DD[T]HH:mm:ss.SSS[Z]'))
|
result += og('og:updated_time', moment(updated).format('YYYY-MM-DD[T00:00:00.000Z]'))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue