Custom Content Apps

Create Magnolia content apps that access Web service data sources. Implement hierarchical containers and handle complex content items.

Antti Hietala
Technical Documentation

--

Consuming content from external sources is a standard practice in Web publishing today. Everybody has existing content: products, prices, inventory, images... This varied content is stored in many places: legacy applications, Web services and file systems.

Today, the key content management task is not writing editorial content. Ingesting small pieces of information from various sources and assembling them into a coherent Web offering has replaced writing. Any ecommerce site is testament to a very complex orchestration effort.

Apps for custom content

At Magnolia, we created a special app type to make consuming and managing external content repositories easier. Content apps are designed to manage structured data. They pull information from outside the content management system and present it to editors in a friendly app UI. Editors can enrich the content further and mix it into the website.

Example content app that manages antique cars

Content app framework

Because content apps are used often, Magnolia CMS provides a content app framework to make building them faster.

My developer colleague Christoph and I wrote extensive documentation for app builders, focusing on how to take advantage of convenience classes in the framework:

  • A tutorial that walks you through building your first app. It’s a fun little exercise with antique cars.
  • An example that shows how to consume content from the file system, instead of the usual JCR repository.
  • Configuration reference for all pieces of the framework.
  • Design guidelines for making the app a joy to use.

Armed with these docs we thought we had the bases covered. But we missed something rather crucial.

Containers are complex

As the first developers in the Magnolia community started building content apps they hit a wall we had not anticipated.

“I am stuck on how to create a custom RESTful container. For me this is the starting point and it would be helpful to get an idea how this works. I don’t get the real idea from all these methods”

“For displaying custom content in a tree, there is no abstract container to extend, I have to implement a hierarchical container by myself.”

Direct feedback from readers is my absolute favorite thing about working with open-source software. Everything I write is public by default. Anybody can comment, and they will.

Developers had difficulty implementing the container. In a Magnolia app, the container represents the data source. It holds the content items, such as products, and provides methods for getting, adding and removing them.

We had failed to provide enough examples of containers. Granted, we had a standard container for accessing JCR data and another for accessing the file system. But what about data in the cloud? In a REST Web service? Hierarchical data?

Hierarchical containers and items

In a new tutorial we focus on containers and complex content items. The example is an app that allows editors to browse photos from Flickr and use them on the site. Flickr has a Web service data source so it demonstrates well how to access a REST-based API.

Flickr photos in a content app

Flickr also presents us with the problem that developers faced when handling complex content items. Namely, not everything can be handled as a simple string. Flickr photos can belong to more than one album. This hierarchical relationship between photos and albums is best represented with a Java object item. The new tutorial dedicates a whole section to content apps with an Object ItemId and different containers.

Start now: Creating a custom content app

--

--

Antti Hietala
Technical Documentation

Product manager, average skier, awful fisherman. Yes-hat wearer. Fan of hot glue.