IMMERSE 2016 Introducing content fragments

Preview:

Citation preview

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

A virtual developer conference for Adobe Experience Manager

Introducing Content FragmentsStefan Grimm | Senior Developer

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Introducing Content Fragments

2

1 | Welcome and Overview

2 | Theory

3 | A real world example …

4 | … and its implementation

5 | Q&A

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 3

Theory

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 4

Building blocks

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 5

Overview, part 1

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 6

Semantic content structure Defined by template Multiple formats supported Rich text Plain text Markdown (limited)

Elements

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 7

Variants of element content Global – shared by all elements For example: Channel-specific Defined by author Multiple formats Same as supported for elements

Variations

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 8

Example

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 9

Overview, part 2

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 10

Tags for classification Standard asset metadata Uses metadata schemas

Metadata

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 11

Associate media with a fragment Work as suggestion for the author of the final page No concept of semantic association (no “title image”, etc.)

Based on DAM collections

Associated content

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 12

Structure of a Content Fragment Elements Predefined Variations (optional) Initial associated content (optional)

Copied to the fragment Template changes not reflected in fragment after creation

Use Granite’s ConfMgr feature

Fragment Templates

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 13

Renders a Content Fragment on an AEM page Options for rendering Element to display Variation to use Paragraph ranges

Component

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 14

DAM integration

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 15

A Content Fragment is an Asset (hierarchy)

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 16

Elements are assets/sub-assets Content is stored in the original rendition

Variations are renditions Variations are tied to elements

Metadata stored on main asset Additional structural data (“fragment model”) MIME type specified on rendition

A Content Fragment is an Asset (hierarchy)

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 17

“Use the API, young padawan!”

com.adobe.cq.dam.cfm

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 18

A real world example

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 19

Introducing:The Adobe Times

(An imaginary news site)

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 20

Our goal …

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 21

Out of the box …

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 22

Simple fragment template Single element

Generic component for page authoring provides “in-between” content feature

AEM 6.2

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Hands on …Using Content Fragments

23

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 24

Too much work, huh?

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 25

Create article. Enter title. Teaser. Text. Classify. Save. Create page. (*) Add Content Fragment. (*) Reference article. (*) Publish. (*)

(*) We’ll get rid of these steps in the “Efficient Publishing with Content Fragments” session later today

Efficiency!

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 26

Articles

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 27

Articles

Section

Title

Teaser

Text

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 28

Fragment Elements Title Teaser Text

Metadata Section

Articles

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 29

A real world implementation

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 30

Create an article template Create an article component Create a page component

TODOs ...

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

No production-ready codein this session!

Disclaimer

31

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 32

Article template

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Hands on …Article template

/apps/settings/dam/cfm/templates/article

33

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 34

Article component

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 35

Access the elements Title, Teaser, Text

Access metadata Section

Bring everything together Rendering

We need to …

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 36

Creating a fragment:Resource fragmentResource = resolver.getResource(“/path/to/fragment”);ContentFragment fragment = fragmentResource.adaptTo(ContentFragment.class);

Accessing elements:Iterator<ContentElement> elements = fragment.getElements();while (elements.hasNext()) {

ContentElement element = elements.next();// …

}

API – Basic patterns, part 1

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 37

Accessing variation:Iterator<ContentVariation> variations = element.getVariations();while (variations.hasNext()) {

ContentVariations variation = variations.next();// …

}

Accessing elements/variations by name:ContentElement titleElement = fragment.getElement(“title”);ContentVariation twitterVariation = titleElement.getVariation(“twitter”);

API – Basic patterns, part 2

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 38

Accessing content:String content = element.getContent();String contentType = element.getContentType();

Changing content:element.setContent(“Content”, “text/plain”);

… works similar for variations!

API – Basic patterns, part 3

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 39

Map<String, Object> getMetaData();void setMetaData(String name, Object value) throws ContentFragmentException;

Just a wrapper for DAM metadata methods! - Same rules & restrictions apply.

API – Accessing metadata

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 40

Currently no API to get HTML for plain text or Markdown Need to use a internal include

(Missing) API – Getting HTML

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Hands on …Article component

/apps/cfm-efficient-publishing/components/article

41

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 42

Page component

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 43

“Just a simple page template” Header (”The Adobe Times”) hardcoded Single paragraph system holding the article

/apps/cfm-efficient-publishing/components/page No design No ”fancy stuff” like responsiveness, etc. Remember? - No production-ready code in this session!

JASPT

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

And … Action!The new article creation process

44

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 45

Recap

Workflow designed for efficiency Template defining three elements Title Teaser Text

Article component Fixed layout Tags for classification Image taken from collection

Page component Basic page layout

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 46

Epilogue

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 47

Decide if creating a customized component makes sense Sufficiency of the OOTB component Flexibility vs. efficiency

Use OOTB component as a starting point Use tagging and metadata to classify your content Use API, don’t access the content structure directly Adobe might need to change it

Recommendations

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 48

Security: Publish considerations

Provide read-access to everyone wherever required Ensure that everything required is available on publish Common mishap: Application Content Package not replicated to publish

Collection can not/should not be accessed on publish References need to be resolved before publishing – manually (OOTB component) or ”on save” (*)

(*) Details will be revealed in the “Efficient Publishing with Content Fragments” session later today

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 49

Not mentioned in this session …

Variations/channel-specific publishing would rectify a separate session may be a focus for 6.3

Translation services neatly integrated

Metadata schemas

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 50

Resources

Content Package with example code available from the “Resources” pod in Adobe Connect

Documentation Overview/Authoring Editor - https://docs.adobe.com/docs/en/aem/6-2/author/assets/content-fragments.html Page Authoring - https://docs.adobe.com/docs/en/aem/6-2/author/page-authoring/content-

fragments.html Development Templates - https://docs.adobe.com/docs/en/aem/6-2/develop/templates/content-fragment-

templates.html Extending (WIP) - https://docs.adobe.com/docs/en/aem/6-2/develop/extending/content-fragments.html

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.

Q&A51

Stefan Grimmsgrimm@adobe.com

© 2016 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.