How to serve dynamic blog articles from an external API using RenderController in Umbraco 13

I am working on an Umbraco 13 project in which the blog section is entirely powered by an external API (headless-style). The blog index page exists in Umbraco, but the individual article pages are dynamically loaded based on the slug.

example urls : /blog/article1, /articles/article2, ect.

I have three separate domains in this Umbraco instance, and the name of the blog page varies depending on the domain. Therefore, I cannot define a fixed route in Program.cs.

In the RenderController for the BlogPage, I need to override the Index action to accept a slug and render the corresponding article. However, this override is not being invoked. I’ve explored using a custom IContentLastChanceFinder to detect whether the URL refers to an article, based on the slug, and then return the BlogPage node as the published content. While this works, it feels like a workaround and not a clean solution.

What would be the recommended approach in Umbraco 13 to handle dynamic routing for external content like this, especially when the route prefix is variable and cannot be hardcoded?

Hey @D0LBA3B :waving_hand:

I’d recommend taking a look at the custom routing, specifically the use of the IVirtualPageController. Implementing a RenderController will rely on the content finder to kick in, but the IVirtualPageController takes care of this within the controller itself.

Check out Custom MVC Routes | Umbraco CMS

I’m presuming that in the FindContentfunction you’ll likely want to put the blog home or something so you can still grab ahold of bits and pieces (like nav / footer) and then fetch your data in the actual controller action.