Fix dynamic content generation

Since migrating to Next 13, the dynamic route generation logic was broken. Updated it to match the latest API changes.