feat: add config for entire collection
This commit is contained in:
parent
c7679dad26
commit
5f6740c573
2 changed files with 11 additions and 1 deletions
|
@ -42,8 +42,16 @@ const getPostsByCategory = (collection) => {
|
|||
return postsByCategory;
|
||||
};
|
||||
|
||||
const getAllCatalogue = (collection) => {
|
||||
const items = collection.getFilteredByGlob(
|
||||
path.join(dir.input, "content/catalogue/**/*.md"),
|
||||
);
|
||||
return items.reverse();
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
getAllPosts,
|
||||
getAllCatalogue,
|
||||
getAllPostCategories,
|
||||
getAllPosts,
|
||||
getPostsByCategory,
|
||||
};
|
||||
|
|
|
@ -2,6 +2,7 @@ const {
|
|||
getAllPosts,
|
||||
getAllPostCategories,
|
||||
getPostsByCategory,
|
||||
getAllCatalogue,
|
||||
} = require("./config/collections/index.js");
|
||||
const { dir } = require("./config/constants.js");
|
||||
const {
|
||||
|
@ -25,6 +26,7 @@ module.exports = (eleventyConfig) => {
|
|||
eleventyConfig.addCollection("posts", getAllPosts);
|
||||
eleventyConfig.addCollection("categories", getAllPostCategories);
|
||||
eleventyConfig.addCollection("postsByCategory", getPostsByCategory);
|
||||
eleventyConfig.addCollection("catalogue", getAllCatalogue);
|
||||
|
||||
// --------------------- Custom Filters -----------------------
|
||||
eleventyConfig.addFilter("entries", entries);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue