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

Created on 21 Aug 2016  路  5Comments  路  Source: getgrav/grav

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

All 5 comments

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.

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.

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

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

'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 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

philipisik picture philipisik  路  4Comments

matroidde picture matroidde  路  3Comments

superDuperCyberTechno picture superDuperCyberTechno  路  3Comments

flaviocopes picture flaviocopes  路  5Comments

marcastel picture marcastel  路  4Comments