Nested includes possible, e.g. for snippets inside info-boxes?

Hello, I’m new to Jekyll and am looking for a framework to render documentation.

I was wondering if Jekyll is able to render nested includes/snippets. A typical use case are info boxes (“Note”, “Attention”, “Important”, “Warning”) containing some text, which you may be familiar with from online docs.

I saw in the Jekyll docs that these should be no problem with plain Markdown (and probably even HTML) content. But what I’d like to know is whether they may contain includes/snippets themselves.

I haven’t played with Liquid Template syntax yet, so this might be wrong syntax, but I mean something like:

{% include note.html content="
This is some text and a [link](,
but can I use a {% nested.html attrib=foo %} here?
" %}

I know that Hugo currently cannot handle these, so such info boxes would be limited to a (non-snippet) subset of available elements. Since I’d like to use e.g. smart document references that do some extra checking/processing, that’s almost a deal breaker for me.

I don’t think you can directly add Liquid inside of include parameters, but you can use Liquid’s capture or assign tags to get around this limitation.

Something like this should work.

{% capture include_content %}
This is some text and a [link](,
but can I use a {% include nested.html attrib=foo %} here?
{% endcapture %}

{% include note.html content=include_content %}
1 Like

I see, thanks for the info!