Foam can be setup and run hierarchical. I use this setup for mine with broad groupings at the top (history, medicine, politics, etc) and then subgroups as needed (history -> pandemics, history -> wars, etc). You can use foam-doctor to regenerate paths and titles on a regular basis.