This page https://gohugo.io/templates/template-debugging/ recommends using printf to write variables to the screen in order to determine what values they contain.
I quite often do something very similar in PHP or JavaScript, where I dump an object using print_r(), or sometimes var_dump(), or console.log, or DevTools watch expressions, etc. These tools all provide me with valuable information.
Then there’s Go and Hugo. I try to see what’s in my $.Site.RegularPages variable and I get this:
*page.Pages{(*hugolib.pageState)(0xc000e11650), (*hugolib.pageState)(0xc000aad200), (*hugolib.pageState)(0xc0019b4a20), (*hugolib.pageState)(0xc001448ea0), (*hugolib.pageState)(0xc001c94ba0), (*hugolib.pageState)(0xc001c94de0), (*hugolib.pageState)(0xc001d77080), (*hugolib.pageState)(0xc0016dd4d0), (*hugolib.pageState)(0xc001974cc0), (*hugolib.pageState)(0xc000b0b440), (*hugolib.pageState)(0xc00092c1e0), (*hugolib.pageState)(0xc001448510), (hugolib.pageState)(0xc001448150), …
That… tells me nothing. What am I missing? How can I see what pages are contained with RegularPages?
At least with Menus, I can see there’s a menu called “main”, but not what’s actually in the main menu:
*navigation.Menus{“main”:navigation.Menu{(navigation.MenuEntry)(0xc002e9a0b0),…
I tried looping through Menus and sending . to printf, but I get the same references.
HEeeeeeEEEelp