Skip to content
Advertisement

Wagtail/Django – How to find the template name of wagtail root home page?

I have a root home page made using the default model that comes out of the box with Wagtail. I’m currently trying to create a navbar header that maps out children pages in the following manner:

JavaScript

The problem here is, I’m using the wrong tag. Above I use home_page, but that does not seem to work.

I am able to use:

JavaScript

Which then lists out the menu_pages, but this does not work for a navbar because it won’t always select children pages from the root, due to the general page tag. Any ideas on how I can locate the actual template or page name before adding the: page.get_children.live.in_menu .

To re-iterate, I am using the out of the box home page model:

JavaScript

The title of the root page is called Home and the type is Home Page

Thanks for any possible help.

Advertisement

Answer

create a templatetag say nav_tags.py

JavaScript

in the templates in can do so top_menu.html

JavaScript

And so for top_menu_children.html

JavaScript

you check from here wagtailbakerydemo hope that was helpful.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement