This site in 11ty

The whole point of this site was that it was going to be a brutalist, no-frills, and content-driven. I wasn't going to get distracted by my tools, DX, trying to style it up real nice, or any of that garbage.

And here I am, fannying around trying to get nunjucks macros imported via a for loop from a list of components defined in the frontmatter that's also used to fetch styles in the base layout because I can't just have component-like behaviour in this temnplating language and no, I don't want to add a 3rd party nunjucks plugin to my dependency tree, thanks all the same.

Options:

The problem

{% from "components/content-block.njk" import contentBlock %} works fine, but the following doesn't — even though the error claims /components/content-block.njk template not found?


{% if components %}
    {% for name in components %}
        {% set componentName = name | toCamel  %}
        {% import "/components/"+name+".njk" as componentName %}
    {% endfor %}
{% endif %}


It's resolving the camelCased componentName variable correctly if the path has a leading / but not if the path starts components?! it's something to do with path resolution anyway, I think.

Logos

Oh, I'm also making logos in inkscape :/