GRAV page types and their templates

GRAV natively recognises three type of pages: standard, listing and modular. These are well described in the GRAV manual, in Chapter 2 Content/Pages. Each type is rendered in HTML by a particular file of code written in TWIG. TWIG is powerful, fairly easy to read and difficult to write correctly - it provides a standard programming logic and variables with HTML inside.

GRAV has built skeletons that show examples of the page types - see skeletons. It is helpful to look at these as you read the GRAV manual. The "One-page site" demos a modular page based on the Quark theme, and "My Gravatastic Blog" is an example of a listing page. Skeletons can be downloaded so that you can see how the code functions.

Not obvious in the manual is how the page types relate to templates in user/Quark/templates or what happens when a page is not supposed to include some types of templates. The directory pnhb/user/templates/Quark contains all templates. Templates

Page types relate to templates thus: Default.html.twig displays a standard page, blog.hrml.twig displays a listing page as a blog and modular.html.twig is capable of displaying one of the three sub-types of a modular page inside it: features, hero and text - all of which are demonstrated in the one-page site.

A standard page can contain and display other pages, and the TWIG code can arrange them in various ways on the physical page, such as with sidebars and footers. The internal pages cannnot be modular (in the modular directory) - this leads to a PHP error.

A moduar page in Quark can only display these sub-types: features, hero and text. An interesting thing is that a modular page simply ignores pages that are not of a sub-type defined in the Modular directory. I exploit this, be it a bug or a feature, in the Conductors page as an example - it enables me to keep the Conductor bios inside the Conductors page though they are not displayed on that page.

A blog page (our archives) is displayed by blog.html.twig. The pages in the blog all have the template blog-item. The listing of blog teasers is displayed by the TWIG file blog-list-item. When the reader selects one of the items,that item is displayed in a new window or tab by blog-item.html.twig.

The directory pnhb/user/themes/Quark/partials contains small sections of TWIG code that are used as helpers by the main types descibed above. They function rather like subroutines in standard programming languages and can be passed parameters.