fix(openGraph): only add article: tag for posts only

This commit is contained in:
curben 2019-09-04 02:35:28 +01:00
parent 07ab8c08d7
commit ffd57460c7
No known key found for this signature in database
GPG Key ID: 5D9DB57A25D34EE3
1 changed files with 6 additions and 2 deletions

View File

@ -118,7 +118,8 @@ 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()) &&
this.is_post()) {
// Skip timezone conversion // Skip timezone conversion
result += og('article:published_time', moment(published).format('YYYY-MM-DD[T00:00:00.000Z]')) result += og('article:published_time', moment(published).format('YYYY-MM-DD[T00:00:00.000Z]'))
} }
@ -126,8 +127,11 @@ function openGraphHelper (options = {}) {
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[T00:00:00.000Z]'))
result += og('og:updated_time', moment(updated).format('YYYY-MM-DD[T00:00:00.000Z]')) result += og('og:updated_time', moment(updated).format('YYYY-MM-DD[T00:00:00.000Z]'))
if (this.is_post()) {
result += og('article:modified_time', moment(updated).format('YYYY-MM-DD[T00:00:00.000Z]'))
}
} }
} }