Skip to content

Add template blocks support to Markdown files #2892

@ngustavo

Description

@ngustavo

Is your feature request related to a problem? Please describe.

I've struggled so many times with creating an end-user-friendly setup with content blocks inside index.md that I think this could be someone else's issue too.

Describe the solution you'd like

Use template blocks in Markdown files, e.g. Pug, Nunjucks, Liquid block syntax

I suggest using MDC-like syntax:

# Blocks!
::motd
Hello World!
::

layout.njk

{{ content | safe }}
<p class="motd">
  {% block motd %} N/A {% endblock %}
</p>

output

<h1>Blocks!</h1>
<p class="motd">Hello World!</p>

Describe alternatives you've considered

Using front matter data passed to layouts by cascading. This is not optimal due to lack of syntax highlighting for markdown. These variables are intended for simple strings, not code-like data.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-votesA feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions