getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.48k stars 1.4k forks source link

Question: create different Modular Page/s from admin with custom modules/templates #997

Closed Gong-Bao-Chicken closed 8 years ago

Gong-Bao-Chicken commented 8 years ago

In the documentation a modular.md is created as explained here.

My Question is: Can i create two modular pages from the backend. One called home and one called e.g. company. i dont want to add this part of code in home.zy.md and company.zy.md everytime i create a modular page:

content:
    items: '@self.modular'
    order:
        by: default
        dir: asc
        custom:
            - _showcase
            - _highlights
            - _callout
            - _features

Can this be defined in the blueprint / template for a modular page? I cant find anything related to this in the docs...

thanks

rhukster commented 8 years ago

You can have multiple modular pages with the same markdown file type if you wish.

Take a look at the onepage skeleton package. There are two modular subpages that use the same feature.md filename, meaning they share the same feature.html.twig template, but their content is different.

Gong-Bao-Chicken commented 8 years ago

Hell @rhukster , I checked the solution you mentioned and saw, that the website consists only of one modular page, which reuses different modules.

Maybe i wrote down my intentions too poorly.... I wanted to ask, if i can define a template or blueprint in a way that it specifies which modules are usable for a modular page.

For example:

If i want the Homepage- and the Company-page of a business website to be modular pages. But consist of common or different modules. Is it possible to define for example a Hompage Template + Blueprint that together specify wich modules are usuable and which are not WITHOUT modifiying the .md file ! Reason: I dont want an editor to access the.md files, but allow him to choose from different modular templates, that allow him/her to create modular pages.

rhukster commented 8 years ago

Ah ok, that makes it more clear. By default in this skeleton and in most examples, we use items: '@self.modular', so this is going to look at the modular sub-pages of the current page (dictated by preceding _ in the folder names.

however, you can construct this collection based on a taxonomy, which means it will gather up pages based on a page's taxonomy.. Or you could use Grav's ability to combine collection types (complex collections) and build a collection with @self.modular and also other collection types of a specific page or a taxonomy collection. See this page on the various types of collections:

https://learn.getgrav.org/content/collections#complex-collections

Gong-Bao-Chicken commented 8 years ago

First of all sorr yfor my slow response and thanks for your immediate answer. I looked over the documentation of complex collections for a couple of minutes.

If i understand correctly with complex collections i can define the content, order and other input fields for a page template in the corresponding templatename.yaml in the blueprint folder? That sounds like a good idea if i understand corrrectly.

Another question: I saw, that it is possible to 'add page' and 'add folder' from the admin plugin menu. What exactly is the difference? Is a folder fundamentally different to a page?

Thanks for you help, greetings from Switzerland

rhukster commented 8 years ago

'Add Folder' essentially create's an empty folder. This has it's uses without an accompanying page file, like housing a bunch of images. We added this later after it was requested several times :)