Expand Nested Content Area

We often get asked about if Content Delivery API can expand nested content areas within a single call. Content Delivery API out of the box you cannot do that. However we have created an that manipulates the Content Area Content API Model to return multiple nested content areas with one call.

The addon extends the expand functionality and put in support to limit the recursion to a specified level.

Nested Content Area out of the box

Nested Content Area with the addon

Install and Optionally Configure

Dependencies require Content Delivery API 3.0 and above.

Install via nuget which is located at the follow url:

HiddenFoundry.ContentDeliveryApi.ExpandContentAreas

Install via package manager

Install-Package HiddenFoundry.ContentDeliveryApi.ExpandContentAreas

Configuration is optional and not specifying this will default the expand maximum level is 2. Which is enough to expand the first nested content area.

To configure the maximum levels deep you wish the recursively load through, add the following in your startup.cs

services.ConfigureRecursiveContentAreaContentApiOptions(o =>
    o.MaxExpandContentAreaLevels = 4;
});

Circular References

Now you've installed the addon; you must let your editors be aware of circular references. As with the flexibility of Content Cloud, you are free to place pages / blocks virtually in any content area you want.

However if you have a chain of blocks and the last block references the first block then you have a circular reference. Content Delivery API does not know how to handle this and will return an error after timing out. This is most likely why out of the box, Content Delivery API does not expand past the first level and requires you to make a second call.

Take this into consideration when your are content model designing and take advantage of the configurable max expand level option.