How to Build a Portfolio

I’ve been debating how to build out my portfolio pages for the last few days. The current pages are all flat files that required a ton of work to create, and have been a nightmare to update. I’d like to create a portfolio section that uses one template and pulls all the data in dynamically. It’s not necessarily the template or the scripting to build it that I’m concerned about. But I do need to make sure the means of storing the portfolio data is as flexible as possible. I want the ability to insert pieces into the middle of a category, to sort by name or category, to rearrange or rename categories, and to be able to attach a number of larger versions available for each piece.