docs: add note about getFilteredByGlob cache behavior

This commit is contained in:
Ricardo
2026-03-28 19:57:48 +01:00
parent 5ca8f83873
commit c6ea35d28a

View File

@@ -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;