Can someone explain local_data_enhanced to me?

I’ve been using the local_data_enhanced object to manipulate my data before creating some dynamic pages on the top of the manipulated (“enhanced”) data.

This works like this:

data.products.each do |p|
	manipulateProductData(p)
	proxy buyingGuideURL(p), "/product.html", locals: { nav_slug: "product", product: p}, ignore: true
end

… where manipulateProductData is a function in a module I load in config.rb. What middleman does is it populates a @local_data_enhanced object which is the one I then access when building the pages, rather than the original @local_data object.

As my products.yml file is getting way too long and complex, I want to break it up into individual product files in a product subdirectory (see this topic). Accordingly, I created my subdirectory and now my code looks like this:

data.product.each do |prod, p|
	manipulateProductData(p)
	proxy buyingGuideURL(p), "/product.html", locals: { nav_slug: "product", product: p}, ignore: true
end

However, for some reason no @local_data_enhanced object is created. How is this meant to work? What am I doing wrong? Any help would be appreciated.