AEM Blogs x How-To's

${ AUTHORING MODE }

Latest post

How To Render Browser-Stored Content in the Authoring View

14 mins read
  • #frontend
  • #backend
  • #touch-ui
  • ...

What if the content for your component is not in the repository? A visitor did something in the browser, the page wrote a cookie, and later a component has to turn that cookie back into markup. On Publish, JavaScript can populate the list after the page loads. In the AEM editor, though, I'd rather have the component render its content directly so authors can see what they're working with. When we save the dialog, we also need AEM to render the updated component. For this example, we'll refresh the editor page and let our Sling Model read the cookie again.

So what can we do?

We're going to look at how to build a component that stores IDs in a cookie. In edit mode it renders those IDs while the page is drawn. On Publish it leaves the first response alone and fills the list with a second request. Swap the IDs for whatever content you store: pages, products, locations, articles… The request split stays the same.

Continue reading →

Featured Posts

See all posts →