fix: only show updated date when it's later than published date

This commit is contained in:
草师傅 2025-08-11 17:45:42 +08:00
parent b2270003bd
commit 5ac24d0bc2
Signed by: gb
GPG key ID: 43330A030E2D6478

View file

@ -65,7 +65,7 @@ const cover = customFeaturedImage || matchedImage_src?.src || firstImageURL || `
<h1 class="title">{entry.data.title}</h1> <h1 class="title">{entry.data.title}</h1>
{authorInfo.map((a: any) => <AuthorInfo data={a} />)} {authorInfo.map((a: any) => <AuthorInfo data={a} />)}
<span class="date">{pubDate}</span> <span class="date">{pubDate}</span>
{pubDate === lastUpdatedDate && <span class="date">({t('article.last_update')} {lastUpdatedDate})</span>} {new Date(lastUpdated) > new Date(entry.data.date) && <span class="date">({t('article.last_update')} {lastUpdatedDate})</span>}
<span>|</span> <span>|</span>
<span class="wordcount">{wordcount.words} {t('article.word_count')}</span> <span class="wordcount">{wordcount.words} {t('article.word_count')}</span>
{ (cover && cover !== firstImageURL && cover !== `/blog/${slug}/featured.png`) && <Image class="cover" width=720 height=480 src={cover} alt={`cover of ${entry.data.title}`} /> } { (cover && cover !== firstImageURL && cover !== `/blog/${slug}/featured.png`) && <Image class="cover" width=720 height=480 src={cover} alt={`cover of ${entry.data.title}`} /> }