👉 Note: 11ty & Nunjucks.
You will need to install the following tools. Depending on your working style, you can choose one or both of them.
Below is an example of the folder structure on my website. Read this section to understand why this structure is important for all parts work together.
dinhanhthi.com
|- _built/ # The output folder (11ty renders markdown files to this)
|- .eleventy.js
|- notes/
|- blog/ # contains all markdown files
|- 2022-06-25-name-of-post.md
|- img_post/ # contains all images
|- 2022-06-25-name-of-post/ # the same name as markdown file
|- figure-1.png
|- figure-2.png
Some remarks,
.eleventy
You need to make 11ty recognize "blog" and "img_post".
module.exports = function (eleventyConfig) {
// For images
eleventyConfig.addPassthroughCopy({ "notes/img_post": "img_post" });
return {
// other settings
dir: {
input: ".",
output: "_built",
},
};
}
Make sure you have the Markdown All in One and Markdown Image extensions already installed.
Go to Makdown Image settings: