Slide 1

Slide 1 text

Oliver Ash & Sébastien Cevey The Guardian (@OliverJAsh and @theefer) Building a CMS for the responsive web

Slide 2

Slide 2 text

The Guardian’s new CMS Composer – Rich AngularJS SPA Scribe – Open Source rich-text editor

Slide 3

Slide 3 text

Why build our own CMS? Because it’s fun Because we’re special Because we’re smarter than other people Because we had to

Slide 4

Slide 4 text

Why build our own CMS? 1. Rich content model 2. Responsive presentation

Slide 5

Slide 5 text

Rich content model

Slide 6

Slide 6 text

Rich content model [[ Picture of newspaper page to highlight richness ]]

Slide 7

Slide 7 text

Rich content model [[ Picture of newspaper page to highlight richness ]]

Slide 8

Slide 8 text

Rich content model [[ Screenshots showing rich page (Bison? Liveblog with embeds?) ]]

Slide 9

Slide 9 text

Rich content model [[ Screenshots showing rich page (Bison? Liveblog with embeds?) ]]

Slide 10

Slide 10 text

Rich content model

Slide 11

Slide 11 text

Rich content model

Slide 12

Slide 12 text

Rich content model ● Fields & metadata ● Document structure ● Semantic markup ● Embeds

Slide 13

Slide 13 text

● Fields & metadata ● Document structure ● Semantic markup ● Embeds Rich content model

Slide 14

Slide 14 text

Many standard fields Section Headline Standfirst Main image Byline and contributors

Slide 15

Slide 15 text

Many standard fields Link text Trail text Trail image

Slide 16

Slide 16 text

Many standard fields

Slide 17

Slide 17 text

Fields & metadata – automation ● Automate manual labour ○ Sensible defaults ○ Allow overrides

Slide 18

Slide 18 text

Rich content model ● Fields & metadata ● Document structure ● Semantic markup ● Embeds

Slide 19

Slide 19 text

Before: HTML blob Too loose for our needs: ● Standard structure for frontends to consume ● Support a variety of content types ● Ability to record metadata, alternative assets After: JSON structure Document structure

Slide 20

Slide 20 text

Document structure Block Element Asset Block Element Asset ... ... ... Body

Slide 21

Slide 21 text

Liveblog structure Block Element (text) Asset Block Element (image) Asset ... title: “GOAL! Liverpool 2-1 Southampton” keyEvent: true text: “

He’s got his goal!

” caption: “Daniel Sturridge..” alt: “Daniel Sturridge…” ... Element (text) text: “

76 min: Lambert…” url: “http://static.guim.co.uk/...” width: 460 ... url: “http://static.guim.co.uk/...” width: 1024 ...

Slide 22

Slide 22 text

Liveblog structure

Slide 23

Slide 23 text

Article structure Block Element (text) Element (video) text: “

Many of his tweets...” html: “(“How to wash...” html: “<blockquote class=”tweet”..” ...

Slide 24

Slide 24 text

Gallery structure Block Element (image) Asset caption: “New York City, ...” alt: “New York City, 2000” ... url: “http://static.guim.co.uk/...” width: 1024 ... ... Element (image) Asset caption: “Portugal, 1976 ...” alt: “Portugal, 1976” ... url: “http://static.guim.co.uk/...” width: 1024 ... ...

Slide 25

Slide 25 text

Document structure – summary ● JSON tree structure ● Metadata records at all levels ● Helps drive features based on semantics (updates, multiple assets for an image, etc.)

Slide 26

Slide 26 text

Rich content model ● Fields & metadata ● Document structure ● Semantic markup ● Embeds

Slide 27

Slide 27 text

Semantic markup ● HTML used for marking up text (body, caption) ○ Inline formatting ○ Lists ○ Blockquotes ● HTML used for semantics, not presentation ○

,

    , etc. ○ , etc Enforced by our rich-text editor, Scribe https://github.com/guardian/scribe

Slide 28

Slide 28 text

Semantic markup – user misbehaviour Actual content:

• Some text
• Some "text"

Desired semantic content:
  • Some text
  • Some “text”

Slide 29

Slide 29 text

Semantic markup – why? ● Easier to style (e.g. bullet point character) ● Readable by robots - Googlebot, Pocket, our own... ● SEO

Slide 30

Slide 30 text

Semantic markup Don’t let editors write HTML. Ever. ⇒ Use our Scribe rich-text editor Do The Right Thing by default. ⇒ Enforce correct behaviour using plugins

Slide 31

Slide 31 text

Rich content model ● Fields & metadata ● Document structure ● Semantic markup ● Embeds

Slide 32

Slide 32 text

Embeds ● Various third party content ○ videos (YouTube, Vimeo, etc) ○ maps (Google) ○ tweets ○ audio (SoundCloud, Spotify) ○ documents (Google Docs) ● Our own content ○ Guardian Video ○ Guardian Witness ○ Guardian Discussion (comments)

Slide 33

Slide 33 text

Embeds – embed codes

Slide 34

Slide 34 text

Embeds – embed codes ● Tedious manual process ● Error prone ○ Invalid syntax ○ Insecure or malicious HTML/JavaScript ● HTML blob, no metadata

Slide 35

Slide 35 text

● Relies on embed.ly + other custom resolvers ● Fast ○ Embeds are more frequent, driving engagement ● Resilient ● Collect metadata programmatically ○ Enables analytics ○ Potentially used for fallback content Embeds – automatic URL resolution

Slide 36

Slide 36 text

Embeds – analytics

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Embeds – sample YouTube metadata elementType: "video" source: "YouTube" url: "https://www.youtube.com/watch?v=XS6ysDFTbLU" description: "Bill Gates accepts Mark Zuckerberg's ALS…" title: "Bill Gates ALS Ice Bucket Challenge" html: "

Slide 40

Slide 40 text

Embeds – custom code Dogue.install();

Slide 41

Slide 41 text

Embeds – custom code Dogue.install(); // ReferenceError: // Dogue is not defined!

Slide 42

Slide 42 text

Embeds – custom code sandbox Sandbox content into using Fence: ● Uses srcdoc (via polyfill) ● Adapts dimensions ● Doesn’t block rendering https://github.com/guardian/fence

Slide 43

Slide 43 text

Embeds – Fence example // Use fence.js var q = 'iframe.fenced'; var node = document.querySelector(q); fence.render(node);

Slide 44

Slide 44 text

Embeds – scripted components When we want: ● Break out of ● Better fallback ● More control, more power! a.k.a. “interactives” from our interactive team or contracted third-parties

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

Embeds – scripted components Historically, scripts injected into the page, take over ● Not resilient ● Not cross-platform ● No fallback ● Content not accessible by editors

Slide 47

Slide 47 text

Embeds – enhancer Target an element with a “boot” script (AMD module) that progressively enhances its contents. Grazing bisons https://github.com/guardian/enhancer

Slide 48

Slide 48 text

● Embedded content: increases engagement ● Automatically resolve URLs to elements ○ Faster, less error-prone ○ Increased metadata ● Custom embed code ○ Sandbox via Fence ● Scripted components ○ Progressive enhancement via Enhancer Embeds – summary

Slide 49

Slide 49 text

Rich content model – summary ● Automation and intuitive UI to reduce editorial cost ● JSON structure to record metadata and assets ● 3 tiers of embeds for different scenarios

Slide 50

Slide 50 text

Responsive presentation

Slide 51

Slide 51 text

Responsive presentation ● Multiple frontends ● Rich responsive layout ● Responsive embeds ● Speed & performance

Slide 52

Slide 52 text

Responsive presentation ● Multiple frontends ● Rich responsive layout ● Responsive embeds ● Speed & performance

Slide 53

Slide 53 text

Responsive web design ● One website, many devices Multiple frontends http://www.theguardian.com/

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

Multiple frontends Responsive content ● Multiple frontends ● Another dimension of RWD Content Content API ?

Slide 56

Slide 56 text

Multiple frontends – WYSI NOT WYG The CMS cannot render final result: ● Too many frontends ● Frontends change very quickly ● Devices may differ (no JS, touchscreen, etc.) Editors are responsible for content Frontends are responsible for presentation

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Responsive presentation ● Multiple frontends ● Rich responsive layout ● Responsive embeds ● Speed & performance

Slide 60

Slide 60 text

Element weighting ● Editorial hints for the presentation layer ● Depends on frontend and breakpoint

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Pull quotes elementType: "pullquote" html: "

That’s the thing that is partly..." attribution: "Tracy Droz Tragos" Element (pullquote)

Slide 65

Slide 65 text

Responsive presentation ● Multiple frontends ● Rich responsive layout ● Responsive embeds ● Speed & performance

Slide 66

Slide 66 text

Responsive embeds Embedded by URL CSS trick using fixed-ratio wrapper sandbox Auto-sizing by Fence Scripted components In the document or <iframe> with standard resizing hooks using postMessage

Slide 67

Slide 67 text

Responsive presentation ● Multiple frontends ● Rich responsive layout ● Responsive embeds ● Speed & performance

Slide 68

Slide 68 text

Speed & performance Exploit JSON structure to: ● Default to smaller image assets ● Pick the best video encodings ● Render tweets only on tablet/desktop ● etc.

Slide 69

Slide 69 text

Responsive presentation – summary ● Not WYSIWYG ● Editors influence presentation through metadata ● JSON structure enables frontends to make better choices

Slide 70

Slide 70 text

Conclusion ● Richer data model but faster to work with ● Guarantee correctness and resilience ● Edit content (semantics), derive presentation A good content model should enable richer and more responsive presentation

Slide 71

Slide 71 text

Thank you! Any questions? Psst, we are hiring! http://developers.theguardian.com/