It may take a bit of time, but developing your own tree (like a behavior tree or dialog tree, but for pages) might be beneficial. And you could use one of those as a model. Something like this:
How do dialog trees work?How do dialog trees work?
This would allow you to tailor it for your specific needs, but also let the code handle most of the work.