moved page templ_vars generation into separate function to have the metadata in sync while redering