mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-05-15 06:58:50 +02:00
fix: use pinned property for featuredPosts collection
Renamed from "featured" to "pinned" to avoid conflict with the "featured" hero image property in MF2/Micropub. Handles both boolean and string "true" values from YAML frontmatter. Confab-Link: http://localhost:8080/sessions/bd3f7012-c703-47e9-bfe2-2ad04ce1842d
This commit is contained in:
+3
-2
@@ -856,12 +856,13 @@ export default function (eleventyConfig) {
|
|||||||
.slice(0, 5);
|
.slice(0, 5);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Featured posts — curated selection via `featured: true` frontmatter
|
// Featured posts — curated selection via `pinned: true` frontmatter
|
||||||
|
// Property named "pinned" to avoid conflict with "featured" (hero image) in MF2/Micropub
|
||||||
eleventyConfig.addCollection("featuredPosts", function (collectionApi) {
|
eleventyConfig.addCollection("featuredPosts", function (collectionApi) {
|
||||||
return collectionApi
|
return collectionApi
|
||||||
.getFilteredByGlob("content/**/*.md")
|
.getFilteredByGlob("content/**/*.md")
|
||||||
.filter(isPublished)
|
.filter(isPublished)
|
||||||
.filter((item) => item.data.featured === true)
|
.filter((item) => item.data.pinned === true || item.data.pinned === "true")
|
||||||
.sort((a, b) => b.date - a.date);
|
.sort((a, b) => b.date - a.date);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user