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

Section id in modular pages

Solved by Vadym View solution

Started by mmm 4 years ago · 5 replies · 524 views
4 years ago

Hi,
maybe a dumb question but difficult to find answers about, due to the search term.
I use a theme that inherits from quark theme on grav 1.7.37.1 and have modular pages.
The question is: in modular pages (in particular hero.md) where the id of the section come from? How the page is built? There's a flow explanation or images somewhere?
Yes in fact, these are two questions...

Many thanks

4 years ago

I am not a quark user or fan, but from the hero template it looks like the id comes from the header of the modular page.

I am assuming id is an alias for page.header.id just as title is an alias for page.header.title and others. Have you tried adding an id header to hero.md?

Try it and let me know.

4 years ago mmm yes first thing i tried id: myid does not work :(

@backit:
maybe a dumb question

@backit:
yes first thing i tried

So it wasn't a dumb question, but generally a good question, with the best chance of a successful response, would involve as much relevant background info as possible. So if you've tried something, please mention it in future.

👍 1
last edited 10/21/22 by Hugh Barnes
4 years ago Solution

Hi, if you're asking about anchor link IDs, take a look at the modular page template, you will also see how a modular page is build.
Specifically, line 50 for hero block ID (line 32 for nav part), and line 57 for other blocks
<div id="{{ module.menu|hyphenize }}"></div>
So, menu variable is used, which fall-backs to the "title" if "menu" is not set. You can set it through the admin panel or in the .md file of the page.
But if you meant hero section ID, in case of modular page as I see the ID var is unset, due it's could be multiple hero blocks on one page.

👍 1
last edited 10/21/22 by Vadym

Suggested topics

Topic Participants Replies Views Activity
General · by jean-louis67, 3 weeks ago
2 308 3 weeks ago
General · by Andy Miller, 3 weeks ago
0 310 3 weeks ago
General · by Veehem, 4 weeks ago
0 263 4 weeks ago
General · by milkboy, 4 weeks ago
0 264 4 weeks ago
General · by ian russell, 1 month ago
2 335 1 month ago