grav-plugin-static-generator icon indicating copy to clipboard operation
grav-plugin-static-generator copied to clipboard

`pages` undefined in twig templates when generating static site

Open voodoos opened this issue 3 years ago • 3 comments

I have a weird issue with my Grav project. I would like to use grav-plugin-static-generator to generate a static version of my site. I use the following command:

bin/plugin static-generator page "/" -a -s -i

Then if I have a page whose templates does {{ print_r(pages) }}. If I reach that page in the live website the root page object is printed as expected.

However in the generated page nothing at all is printed, as if the variable was undefined. This messes the menu generation.

Am I doing something wrong ?

  • Grav is v1.7.16
  • My theme is a heavily modified version of the Quark theme.

voodoos avatar Aug 18 '21 18:08 voodoos

Were you able to reproduce the issue ? If you don't I can try to provide one.

Is there a version of Grav, or that plugin that I can downgrade to to build my website ?

voodoos avatar Aug 23 '21 08:08 voodoos

I've not had time to work on reproducing it, if you could reliably do so a zipped copy of Grav would help a lot. It should be compatible with all of 1.6-1.7, though I'm not sure how well it would work with print_r. Is that ran as a function through a Twig-extension?

OleVik avatar Aug 23 '21 21:08 OleVik

I'm new to Grav. I have the same issue. I just installed Grav (v 1.7.46). It creates 2 pages, with the Quark theme. The navigation menu uses 'pages' to create a link per page. It works fine in live, but the menu is empty with the SSG plugin...

sdegrande avatar Aug 07 '24 15:08 sdegrande