mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-15 15:08:51 +02:00
feat: use lastItemAt for feed freshness in feedland widget
Shows when a feed last published new content instead of when it was last checked. Falls back to lastFetchAt for blogs not yet re-synced.
This commit is contained in:
@@ -189,7 +189,7 @@
|
|||||||
<a :href="blog.siteUrl || blog.feedUrl" target="_blank" rel="noopener"
|
<a :href="blog.siteUrl || blog.feedUrl" target="_blank" rel="noopener"
|
||||||
x-text="blog.title" @click.stop></a>
|
x-text="blog.title" @click.stop></a>
|
||||||
</span>
|
</span>
|
||||||
<span class="fl-when" x-text="relativeTime(blog.lastFetchAt)"></span>
|
<span class="fl-when" x-text="relativeTime(blog.lastItemAt || blog.lastFetchAt)"></span>
|
||||||
</div>
|
</div>
|
||||||
{# Expanded items #}
|
{# Expanded items #}
|
||||||
<div class="fl-items" x-show="expandedId === blog.id" x-collapse>
|
<div class="fl-items" x-show="expandedId === blog.id" x-collapse>
|
||||||
@@ -238,8 +238,8 @@ function feedlandWidget() {
|
|||||||
sorted.sort((a, b) => (a.title || '').localeCompare(b.title || ''));
|
sorted.sort((a, b) => (a.title || '').localeCompare(b.title || ''));
|
||||||
} else {
|
} else {
|
||||||
sorted.sort((a, b) => {
|
sorted.sort((a, b) => {
|
||||||
const da = a.lastFetchAt ? new Date(a.lastFetchAt) : new Date(0);
|
const da = new Date(a.lastItemAt || a.lastFetchAt || 0);
|
||||||
const db = b.lastFetchAt ? new Date(b.lastFetchAt) : new Date(0);
|
const db = new Date(b.lastItemAt || b.lastFetchAt || 0);
|
||||||
return db - da;
|
return db - da;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user