I am using eleventy for a personal blog project. My package.json
looks like that:
{
"name": "personal_blog_eleventy",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "eleventy --serve",
"build": "eleventy",
"debug": "cross-env ELEVENTY_DEBUG=true npx eleventy"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@11ty/eleventy": "^2.0.1",
"cross-env": "^7.0.3"
},
"dependencies": {
"@11ty/eleventy-img": "^3.1.0"
}
}
When running npm run start
the _sites
directory looks like the following:
My eleventy.js
looks like the following:
module.exports = function(eleventyConfig) {
const { imageShortcode } = require("./_data/image.js");
eleventyConfig.addNunjucksAsyncShortcode("image", imageShortcode);
eleventyConfig.addLiquidShortcode("image", imageShortcode);
eleventyConfig.addJavaScriptFunction("image", imageShortcode);
// Passthrough copy for landing_pages
eleventyConfig.addPassthroughCopy("landing_pages");
eleventyConfig.addPassthroughCopy("images");
// Add a collection for blog posts
eleventyConfig.addCollection("posts", function(collection) {
return collection.getFilteredByGlob("posts/*.md");
});
return {
dir: {
input: 'pages',
includes: '../_includes', // Change this line to point to the correct _includes folder
output: "_site"
},
passthroughFileCopy: true,
};
};
My folder structure looks like the following:
.
├── browser_extensions
│ └── url-annotator-extension
│ ├── background_worker.js
├── _data
│ └── image.js
├── images
│ └── 300x200.png
├── _includes
│ ├── blank.njk
│ └── layout.njk
├── landing_pages
│ ├── landing_page-1.njk
│ └── landing_page-2.njk
├── package.json
├── package-lock.json
├── pages
│ ├── index.njk
│ └── projects.njk
├── posts
│ ├── post-1.md
│ └── post-2.md
├── README.md
└── _site
├── images
│ └── 300x200.png
├── img
│ ├── tDnvQu38B3-300.avif
│ ├── tDnvQu38B3-300.jpeg
│ └── tDnvQu38B3-300.webp
├── index.html
├── landing_pages
│ ├── landing_page-1.njk
│ └── landing_page-2.njk
└── projects
└── index.html
13 directories, 28 files
As you can see my landing_pages
do not get compiled correctly and I get the error:
Any suggestions what I am doing wrong?