Dynamic pages from data and reloading when data changes

I’m generating my site by using data files to define the content. Something like the following.

data.people.each do |person|
  proxy "/#{person.slug}.html", "/person.html", locals: { person: person }

The problem with this approach is that when I change my data files, though the files are automatically reloaded, the change isn’t reflected. This is because the routes are only ever defined at boot time (or if I change config.rb). So if I was to define a new person, a new route for them wouldn’t be created. Also, changes to existing data aren’t reflected either (as the local references a stale hash).

If anyone else has encountered this, do you have any recommendations?

I just tested this with my standard setup and I the routes and data files update just fine, without restarting the server. It might be because I’m using a yml file per post, whereas it seems you’re loading data from a yml list (correct me if I’m wrong though).

Thanks for the help!

My app has some custom code, and this was a stripped down example. I did test it before posting, and it doesn’t work in my case. However, it turns out the reason why is that I’m using the unreleased Middleman 5 (i.e. the github master branch). So I guess this is currently broken there, and I reported an issue.

When I was using Middleman 4, it was also broken, and this was my impetus to try the master branch. However, I now think that’s due to my own custom code, and have an idea how I could fix it.

Haha I see I got featured in your issue example :smile:.