Skip to content

Commit f537fde

Browse files
authored
fix: fallback to article:published_time for lastmod (#590)
1 parent 28b6514 commit f537fde

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/utils/parseHtmlExtractSitemapMeta.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,11 @@ export function parseHtmlExtractSitemapMeta(html: string, options?: { images?: b
9191
if (options?.lastmod && element.name === 'meta') {
9292
const property = sanitizeString(attrs.property)
9393
const content = sanitizeString(attrs.content)
94-
if (property === 'article:modified_time' && content && isValidDate(content)) {
95-
articleModifiedTime = content
94+
if ((property === 'article:modified_time' || property === 'article:published_time') && content && isValidDate(content)) {
95+
// prioritize modified_time
96+
if (property === 'article:modified_time' || !articleModifiedTime) {
97+
articleModifiedTime = content
98+
}
9699
}
97100
}
98101

0 commit comments

Comments
 (0)