mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
docs: add note about getFilteredByGlob cache behavior
This commit is contained in:
@@ -1058,13 +1058,13 @@ export default function (eleventyConfig) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Recently edited posts (updated !== published) — for /updated.xml
|
// Recently edited posts (updated !== published) — for /updated.xml
|
||||||
|
// Note: getFilteredByGlob reuses Eleventy's cached template parse, no extra I/O
|
||||||
eleventyConfig.addCollection("recentlyUpdated", function (collectionApi) {
|
eleventyConfig.addCollection("recentlyUpdated", function (collectionApi) {
|
||||||
return collectionApi
|
return collectionApi
|
||||||
.getFilteredByGlob("content/**/*.md")
|
.getFilteredByGlob("content/**/*.md")
|
||||||
.filter(isPublished)
|
.filter(isPublished)
|
||||||
.filter((item) => {
|
.filter((item) => {
|
||||||
if (!item.data.updated) return false;
|
if (!item.data.updated) return false;
|
||||||
// Only include if updated date differs from published date
|
|
||||||
const published = new Date(item.date).getTime();
|
const published = new Date(item.date).getTime();
|
||||||
const updated = new Date(item.data.updated).getTime();
|
const updated = new Date(item.data.updated).getTime();
|
||||||
return updated > published;
|
return updated > published;
|
||||||
|
|||||||
Reference in New Issue
Block a user