"Recursive" Modular page

Hello and thank you for grav as well as for this forum.

I am about to build my first theme. So far the excellent doc could help me a lot. However, now I am encountering the first problem I cannot solve on my own.

I try to make a one page website with multiple modular pages. One of these modules should be some kind of feature list (something like that: http://blackrockdigital.github.io/startbootstrap-heroic-features/ )

I think it might be a good idea when each of these features is a (modular) page on its own - this would make it easy to add, remove and edit features.

To achieve this one would need a modular page inside of the main modular page - you could call that “recursive modular page”.

To do that I did something like that:

user/pages$ tree
└── 01.home
├── _features
│ ├── modular.md
│ ├── _foo
│ │ └── foo.md
│ └── _bar
│ == └── bar.md
├── _home
│ ├── background.jpg
│ └── home.md
└── modular.md

However, the sections “foo” and “bar” don’t seem to be rendered.

I will be glad to provide any additional information if needed! Thank you!

I don’t think nested modular pages are really going to work. Didn’t try it yet, but the logic of a modular page does not really take that scenario in consideration.

Thank you for your reply!

Searching this forum for “nested modular” or “stacked modular” I found some comments by @rhukster being optimistic about the possibility it could work.

Also the one-page skeleton is mentioned a couple of times, however, I cannot find a nested modular page there…

Is there a way to find it out?

Or is it really just stupid to do that? I think for an end user it might be more intuitive to add one feature item at a time (as a page) than using a more sophisticated markdown syntax with title:, content: and image tags…

You can still do that with regular pages, the only thing you need to do is to include the child pages and output their content.

Just by iterating their child pages, like:

{% for p in page.collection %}
<h2>{{ p.title }}</h2>
{{ p.content }}
{% endfor %}

Also in the near future including the Gantry framework will allow to have another abstraction level for this kind of things, by creating particles and assembling parts of a page very easily.

I see! Thank you!

But then, what is the difference between modular pages and child pages? I didn’t really get that yet :slight_smile:

Is it just, that the modular page has no content itself?

Modular pages are composed by multiple parts. But the end result is just a single page. Think of complicated landing pages, for example, impossible to define all at once in a markdown file.

Child pages are childs of a parent page. Think blog posts, where the posts are childs, and the parent is the blog posts list page.

thanks for the explanation. So I understand the different purpose of child pages and modular pages.

But technically a landing page can also be achieved with child pages, right? On the other hand, a blog post list page can not be (easily) be made using a modular page.

It seems like modular pages are a special case of child pages. But what can they do better than regular child pages?

Apart from my remaining unclarity: Thanks for your help, flaviocopes! I could solve the problem, following your suggestion and using child pages instead of modules.