Modular Page Question

I set up a home page as a modular page. Created two modular subpages ( sidebar and content )

This is the code it creates on the home page:

home

Sidebar Content

  1. item 1
  2. item 2
  3. item 3

Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Is there a reason why the main div for each module is an empty div and does not wrap the entire content of that module? See both

and
are both empty 0 height divs.
Just wondering if there is a reason behind this. BTW this is using the default antimatter theme.

Thanks.

Typically a modular page is really a way to build a single page from multiple horizontal blocks of sub-pages. The modular.html.twig template in Antimatter, simply loops over any modular pages and outputs them in divs. As divs are block level HTML this means they are output in horizontal elements.

You wanting to output 2 subpages as a content area and a sidebar is not ideal for modular pages. You would be better off loading a specific page into a sidebar location.

<div class="content">
   {{ content }}
</div>
<div class="sidebar">
   {{ page.find('/sidebar').content }}
</div>

Something like that where your sidebar content is in user/pages/sidebar/default.md

Thanks rhukster,

I was more seeing about using the modular system to create modular pages. Having the actual modules inside of the divs with the id makes it easy to control. I see where I can modify to twig file to make it work but I see you want you mean that it is not the best method.

Thanks for the code snippet. That looks like another great option. One thing I am finding with Grav is that there are many paths to getting something accomplished. The more I familiarize myself with it the more I like it.

Heh, yes, there’s usually 2 or 3 perfectly valid ways to accomplish things. Also another thing to consider is using section shortcodes. https://github.com/getgrav/grav-plugin-shortcode-core#section

Just another option!

rhukster,

That looks quite powerful in itself. I can’t express enough how freeing it feels to be able to make changes to the themes, templates and structure of pages so easily.

Thanks for all the hard work you have poured into Grav and for taking the time still to answer the questions on the forums.