Skip to content
Grav 2.0 is officially stable. Read the announcement →
General

Reuse existing modules in other modular

Solved by pamtbaau View solution

Started by Ramon 3 years ago · 5 replies · 524 views
3 years ago

Hello. I have installed Grav yesterday, far from an expert - but I googled and documentationed before posting this.

Question: Can I reuse existing content as components of a modular page?

That is: Imagine that I have a modular page "modular_page" which shows page A in slot "_top" and page B in slot "_main". Can I use the same page A and page B in slots "_left_top" and "_left_bottom" in the modular page "another_modular_page" - ?

I refuse to believe at this point that the only way is to duplicate page A and page B.

Thank you for your time!

3 years ago

@grav101, On many forums, including this forum, it's a good habit to show which docs you've consulted, what you've tried and where things got stuck.

last edited 04/01/23 by pamtbaau
3 years ago
  1. https://learn.getgrav.org/16/content/modular - the page reads like "create subfolders that start with _", so this is not the answer I was hoping for.
  2. I created a page in the dashboard, gave it the template "Modular" and looked around the admin interface for a way to show existing pages inside this new modular page. I did not find it.
  3. Conversely, in the admin I went to a page that I wanted to show as part of my modular page, and looked around the interface in search of something like "Show this page on another page". I did not find it.
3 years ago Solution

@grav101, Admin does not cater for all possible situations...

Keep in mind that a modular page is constructed using a collection of modules. Have a look at the following sections of the docs:

👍 1
3 years ago

Thank you for the response. It highlights the main issue I am having: I am expected to know a lot about Grav even to ask the most noob question. Complex collection - good to know, thanks!

As I am reading the official page about Complex collections, I keep asking myself: "What is the use case? What everyday problem is solved by this approach? When should I use complex collections and not, for example, simple collections or modular pages?" With my severely limited knowledge, I cannot answer this question, and thus cannot learn enough about Grav to seriously consider it for my business needs.

If a 5-year old asked you "How do I use Grav?", where would you suggest that they start? Thanks.

3 years ago

If a 5-year old asked you “How do I use Grav?”, where would you suggest that they start?

"I'm sorry, but Grav wasn't build for a 5-year old. You first need to go to school, do sports and eat you spinach." ;-)

Grav is build with speed and flexibility in mind, which is why it is a flat-file cms. See the bottom section of About. That lead to the following:

  • It's fast.
  • It's easier to extend.
  • Everything can be done using any file editor you prefer and the CLI.
    This also means you're expected to understand the concepts.
  • Admin is an add-on providing an easy interface for configuration, page editing and necessary tooling.
    Except for easiness, Admin does not add any capabilities to Grav itself.
  • Backup/restore is as simple as copying the /user folder.
  • ...

I agree most of the above is useless to a non-developer who wants to manage all aspects of a cms from a graphical user-interface.

If none of the themes or plugins provide the functionality you require out-of-the-box, you will need to know the concepts of Grav, knowledge of Twig templates and/or PHP to extend the functionality.

Suggested topics

Topic Participants Replies Views Activity
General · by Jerry Hunt, 4 days ago
2 131 23 hours ago
General · by pamtbaau, 1 day ago
1 91 1 day ago
General · by Andy Miller, 2 days ago
0 75 2 days ago
General · by Marcel, 12 months ago
6 386 5 days ago
General · by Duc , 6 days ago
3 71 6 days ago