Can I access Archetype values when rendering a menu?

Each piece of content I have has an image in the Archetype, like so:

title: "Add Child List"
image: "/img/image10.png"

Can I auto-build a menu using SectionPagesMenu = "main" then access page variables (such as image) while in a loop?


Yes …

Sorry if that was ambiguous - i mean I want to render the image paths in my menu.

And let me re-word my question to: “how can I” not “can I”

I was a little fast myself. The SectionPagesMenu = “main” doesn’t generate menu items for the pages (maybe it should) (it just makes the selecting the active page possible).

In general you can access the current page’s parameter, but a menu item isn’t connected to a page, so I don’t think there is a easy way to get to a menu item’s page’s parameter … Which is what you want, I guess. If you look at Hugo’s doc site’s menu, you may be inspired to do this in another way.

I feared as much - It didn’t look like from the documentation that I can add custom properties/attributes to the menu objects either :frowning:

There is a pre and post attribute, have a look at Hugo site for demo.

That might work!

Thanks for your help!