Sounds like the typical case for “conditional rendering” (e.g. showing content according to what the CMS has for the dynamic page).
Here’s a few existing topics with solutions around this
And this video, which is a great starting point too