0

Is there an efficient way to load a Keystone's list's content on every page instead of calling it separately in each view? Perhaps in middlewear.js?

The goal is to make a drop down for the nav.

Quinn Keaveney
  • 1,248
  • 1
  • 17
  • 39

1 Answers1

0

Replace

next()

in your exports.initLocals middlewear with

keystone.list('YOUR_MODEL').model.find().exec( function(err, result) { locals.fontsNav = result; next(); } );

and you can print them like you would any grouping

each link in YOUR_MODEL li(class=(section == link.key ? 'active' : null)): a(href=link.href)= link.label

To answer my own question... solved via https://groups.google.com/forum/#!msg/keystonejs/FDSpXb9qxyM/V_ue1sgrk2AJ

Quinn Keaveney
  • 1,248
  • 1
  • 17
  • 39