Defining content blocks in Markdown Files

I know that this is probably what modular templates are for but I’ve seen static site generators that allow you to define your blocks within your markdown file to allow you to place content within various sections in your template. I understand that this is how the modular templates and work (and more powerfully) but it might be easier for content editors to do such a thing where different parts of the Markdown document can be identified as blocks. Is this something that will ever been seen in Grav, a plugin to be coded, or is this something that I can do now with YAML?

Twig does this already while providing much more power and flexibility than static site generators could ever manage. We use Twig to power our Modular content concept, and that really is what you should use to achieve different content blocks.

Grav is definitely flexible enough that you could create a plugin that did this with tokens or tags right in the content, but I don’t see Grav itself providing two ways of achieving the same thing, especially when the way you are describing is going to be more limited in capabilities than the existing Modular method.

But I guess if you want to do it that way, there’s nothing really stopping you from creating a plugin like that :slight_smile:

That makes sense. So on a clients end if they need to update something they would update the individual markdown files.

I see a nice idea from another file flat cms, this is a markdown file:

This is a main content
- -- sidebar ```
This is the sidebar content

The main content called into template with:

<div class="content">{{ content() }}</div>

For the sidebar content called with:

<div class="sidebar">{{ content('sidebar')</div>

For me the best way is split the contents with files for best organization of data, but we waiting the boss :slight_smile:

@namaless, I’ll have to have a think about your suggestion and how that could work for Grav.

One other thing I want to mention, Grav is intended to be a simple and flexible CMS solution, and as such, the core itself is intentionally minimal. However, we are concurrently working on our Gantry5 theme framework for RocketTheme. This provides complex layout controls with a GUI drag-n-drop interface. We plan on bringing this to Grav also, and it will allow you to drop Gantry-Particles of various types (including markdown) into areas of a page layout. This will bring more sophisticated layout and content control to Grav.

Ofc Rhukster for this i write the best solution is split the content into files, I don’t like huge processing for markdown/twig from page.