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

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

The template "hero" as a separator between modular pages

theme

Solved by pamtbaau View solution

Started by AH 3 years ago · 2 replies · 339 views
3 years ago

When rebuilding a website with Grav and the standard Quark theme, I was faced with the task of creating a window-width separator element that contained an image and could be inserted between modular pages. I was not successful with the modular template "Hero", it always slid upwards. However, this changed when I created a copy of the template (and the corresponding blueprint file). I called it heroidna.html.twig (and the blueprint file heroidna.yaml). And lo and behold, now the window-width images stayed where they were intended. In addition, all the setting options as with the "Hero" are available in the admin area. Is my solution a case of shooting at a sparrow with a cannon? I am happy with it.

3 years ago Solution

@idna, No, that's not shooting with a canon... It's one of two ways to fix your issue.

Have a look at template /user/themes/quark/templates/modular.html.twig lines 48-60. All modules with template modular/hero are drawn at the top of all other module templates.

Because you've created a new module template with a different name, it will be drawn together with the non-hero modules.

If you don't need to preserve the existing modular template for any other page with a hero fixed at the top, you could also edit file /user/themes/quark/templates/modular.html.twig and remove lines 48-53 and remove if module.template != 'modular/hero' from line 56.

3 years ago

Thank you for your explanation. Since I also need a hero image, I'll stick with my solution. Maybe it is also useful for other Grav users.

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 193 2 months ago
Themes & Styling · by Ian, 2 months ago
3 91 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 451 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 45 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 125 3 months ago