├── .gitignore ├── src ├── _includes │ ├── layouts │ │ ├── base.njk │ │ └── page.njk │ └── header.njk ├── home.njk ├── about.njk └── contact.html ├── www ├── about │ └── index.html ├── home │ └── index.html └── contact │ └── index.html ├── package.json └── .eleventy.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /src/_includes/layouts/base.njk: -------------------------------------------------------------------------------- 1 | {{ content | safe }} 2 | -------------------------------------------------------------------------------- /src/_includes/header.njk: -------------------------------------------------------------------------------- 1 |
2 |

{{ title }}

3 |
4 | -------------------------------------------------------------------------------- /src/home.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: HoMe 3 | --- 4 | 5 | {%- extends "layouts/page.njk" -%} 6 | 7 | {% block snippet1 %} 8 | Look upon the "{{ title }}" page! 9 | 10 | {{ "https://bing.com/" | md | safe }} 11 | {% endblock %} 12 | -------------------------------------------------------------------------------- /src/about.njk: -------------------------------------------------------------------------------- 1 | --- 2 | title: AbOuT 3 | --- 4 | 5 | {%- extends "layouts/page.njk" -%} 6 | 7 | {% block snippet1 %} 8 | Here, I write an introduction or whatever… 9 | {% endblock %} 10 | 11 | {% block snippet2 %} 12 | Continuing the writing, I wax on, poetically, of course… 13 | {% endblock %} 14 | -------------------------------------------------------------------------------- /src/_includes/layouts/page.njk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ title }} 6 | 7 | 8 | {% include "header.njk" %} 9 | 10 |
11 | {% block snippet1 %}Some default snippet 1 text{% endblock %} 12 | 13 |
14 | {% block snippet2 %}Some default snippet 2 text{% endblock %} 15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /www/about/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | AbOuT 6 | 7 | 8 |
9 |

AbOuT

10 |
11 | 12 | 13 |
14 | 15 | Here, I write an introduction or whatever… 16 | 17 | 18 |
19 | 20 | Continuing the writing, I wax on, poetically, of course… 21 | 22 |
23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /www/home/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | HoMe 6 | 7 | 8 |
9 |

HoMe

10 |
11 | 12 | 13 |
14 | 15 | Look upon the "HoMe" page! 16 | 17 |

https://bing.com/

18 | 19 | 20 | 21 |
22 | Some default snippet 2 text 23 |
24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/contact.html: -------------------------------------------------------------------------------- 1 | --- 2 | title: CoNtAcT 3 | description: > 4 | Check out https://11ty.dev for more great tips! 5 | --- 6 | 7 | {%- extends "layouts/page.njk" -%} 8 | 9 | {% block snippet1 %} 10 |

Here, I write a {{ title }} introduction or whatever…

11 |
12 | {{ description | md | safe }} 13 |
14 | {% endblock %} 15 | 16 | {% block snippet2 %} 17 |

Continuing the {{ title }} writing, I wax on, poetically, of course…

18 | 19 | {% md %} 20 | This is some *markdown*, now with __things__! 21 | 22 | 1. one 23 | 1. two 24 | 1. three 25 | 26 | - unordered 1 27 | - unordered 2 28 | 29 | ![foo](/bar.webp) 30 | {% endmd %} 31 | {% endblock %} 32 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "11ty-blocks-extends", 3 | "description": "Nunjucks blocks in Eleventy", 4 | "version": "1.0.0", 5 | "author": "", 6 | "bugs": { 7 | "url": "https://github.com/pdehaan/11ty-blocks-extends/issues" 8 | }, 9 | "dependencies": { 10 | "@11ty/eleventy": "^0.12.1", 11 | "dedent": "^0.7.0", 12 | "del": "^6.0.0" 13 | }, 14 | "devDependencies": { 15 | "prettier": "^2.3.2" 16 | }, 17 | "homepage": "https://github.com/pdehaan/11ty-blocks-extends#readme", 18 | "keywords": [], 19 | "license": "ISC", 20 | "main": "index.js", 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.com/pdehaan/11ty-blocks-extends.git" 24 | }, 25 | "scripts": { 26 | "build": "eleventy", 27 | "pretty:www": "prettier www --write" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /.eleventy.js: -------------------------------------------------------------------------------- 1 | const del = require("del").sync; 2 | const dedent = require("dedent"); 3 | const markdownIt = require("markdown-it"); 4 | 5 | module.exports = function (eleventyConfig) { 6 | // Purge the `output` directory. 7 | del("./www"); 8 | 9 | const markdownLib = markdownIt({ 10 | html: true, 11 | linkify: true, 12 | typographer: true, 13 | }).disable("code"); 14 | eleventyConfig.setLibrary("md", markdownLib); 15 | 16 | eleventyConfig.addFilter("md", (text) => markdownLib.render(dedent(text))); 17 | eleventyConfig.addPairedShortcode("md", eleventyConfig.getFilter("md")); 18 | 19 | return { 20 | dataTemplateEngine: "njk", 21 | markdownTemplateEngine: "njk", 22 | htmlTemplateEngine: "njk", 23 | templateFormats: ["njk", "html"], 24 | 25 | dir: { 26 | input: "src", 27 | output: "www", 28 | }, 29 | }; 30 | }; 31 | -------------------------------------------------------------------------------- /www/contact/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CoNtAcT 6 | 7 | 8 |
9 |

CoNtAcT

10 |
11 | 12 | 13 |
14 | 15 |

Here, I write a CoNtAcT introduction or whatever…

16 |
17 |

Check out https://11ty.dev for more great tips!

18 | 19 |
20 | 21 | 22 |
23 | 24 |

Continuing the CoNtAcT writing, I wax on, poetically, of course…

25 | 26 |

This is some markdown, now with things!

27 |
    28 |
  1. one
  2. 29 |
  3. two
  4. 30 |
  5. three
  6. 31 |
32 | 36 |

foo

37 | 38 | 39 |
40 |
41 | 42 | 43 | --------------------------------------------------------------------------------