+ All Categories
Home > Documents > WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data...

WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data...

Date post: 28-Jun-2020
Category:
Upload: others
View: 2 times
Download: 0 times
Share this document with a friend
29
WordCamp Vienna 2020 WP-HTML: The marriage of WP and JS Frameworks for expansion, ubiquity and profit. Enabling any site to embed WP content and functionality by adding: <wp-component></wp-component> <script src=“file.js”></script> Think PLUGINS for HTML!
Transcript
Page 1: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WordCampVienna2020WP-HTML:ThemarriageofWPandJSFrameworksforexpansion,ubiquityandprofit.Enablingany sitetoembedWPcontentandfunctionalitybyadding:

<wp-component></wp-component><scriptsrc=“file.js”></script>

ThinkPLUGINS forHTML!

Page 2: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WordCampVienna2020

MarkTwain:

“Ifyouwantmetogivea2hourtalk,Icandothatstraightaway.

Ifyouwantmetogivea10minutetalk,Iwillneed2weekstoprepare.”

Page 3: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

PublishWPcontent/functionalityanywhereontheInternetwith‘WebComponents’.

WP-HTML:WordPressanywhere,everywhere…

Purposeoftalk

Page 4: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

HTML

Framework...nFramework2Framework1

<scriptsrc=“bundle.js”></script><divid=“app”> WordPress

Page 5: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WordPress

HTML

Framework...nFramework2Framework1

WEBCOMPONENTS

WPComponents

<scriptsrc=“bundle.js”></script><divid=“app”>

WebComponents

WPPHPPAGESGutenbergBlocks

Page 6: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

Mystartincomputingatschoolin1979

AtUniversity

Source:Wikimedia CommonsSource:Wikimedia Commons

Source:Wikimedia Commons

Source:Wikimedia Commons

Where/whatwereyouin1979?

Brighton,UK

TheEnglishChannel

58inhumanyears– 243intechyears

Page 7: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WordCampVienna2020

• MicrosoftCertifiedSystemsEngineer(2000-2003)• MicrosoftCertifiedDatabaseAdministrator(SQL2000)• BusinessInformationArchitectataUKRecyclingCompany• WordPress2017• CurrentlyPWAs(offline/instantwebsites),WebComponents,WP-HTML,GoogleAMPandMobileWebOptimisation.• Developing1-2hourtrainingseminarsforcompanies• Stilljustas‘student’!

Inandoutoftechovertheyears

Page 8: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

Anotherwebsiteownersays:Ifyouprovidemewith• AneasytodeployandusecomponentthatIcanconfiguretomyrequirements• Whichprovidesrelevantandvaluablecontent• Iwillpromoteyourwebsiteandservices/products• ThinkYouTubeembed• MICROAPPS/SERVICES/WEBSITE

Anexampleuse

Page 9: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

ArticlesGuidesBooksCoursesProductsalloncyclingetc…

Wantstoaddusefulinformationonhowcyclingcanbebeneficial,traininginformation,etc.Likea“YouTubeembed”.

WPsitecangainvisibilityandadvertising

DeployingWPMicroAPPs/Blocks

Inreturn,enableWPtoincreasevisibilityand‘sales’.

Sitesellsbikes WPLifestyleSite

Page 10: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

Mynewbusiness:ONESTOPWORDCAMPS

• Awebpagethatshowsall(filtered)WordCampstakingplace• DisplayaWordCamp’sdetailsfromorganiserssite=>Bookit• Beshownflightsforthatperiod=>Bookaflight• Beshownhotelsinthatcity=>Bookahotel• Haveacitytourguidedisplayed/downloadwithbestplacestoeat/visit…

• GiveusersaDASHBOARDofWordCampsandflights/hotel

WebApplicationwithavarietyofMICROAPPS/SERVICES

Multiple‘frameworks’gluedtogether

Page 11: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

InternationalJSConferenceLondon2018– KeyNoteSpeech

Page 12: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

HTML

Framework...nFramework2Framework1

<scriptsrc=“bundle.js”></script><divid=“app”> WordPress

Page 13: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WordPress

HTML

Framework...nFramework2Framework1

WEBCOMPONENTSWEBCOMPONENTS

<scriptsrc=“bundle.js”></script><divid=“app”>

Page 14: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

ThisuseseitheraDIVelementoraCustomElement:customElements.define(‘my-very-own-unique-tag’, JSClass)gives->

<my-very-own-unique-tag></my-very-own-unique-tag>

WeuseJStoinjectHTMLintothetag,(HeadlessCMS),orrenderJSONdatareceived,(DecoupledDMS).

ThiswasthebasisoftheDecoupledSiteandthisledtotheabilitytostoreallthecodeontheWPServerandinjectacompleteblogorformtotheclient=>demo…

WordPressComponent

Page 15: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WebComponents(1)JavaScriptFile:customElements.define(‘my-component',class extends HTMLElement {

//implementationhere…}

});

HTMLpage:<my-componentcustomAttribute=“2”></my-component>

TheseareregularHTMLtags,nativetobrowser,withallthesamefeatures

Page 16: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

§<my-tagattr=“”id=“”…>text…</my-tag>§MUSThaveatleastonehyphenintagname§Wecanaddcustomattributes§Valuesandchangescanbedetectedincomponent…§Wewilllookatanexampleshortly…

WebComponents(2)

Page 17: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WebComponents(3)

Page 18: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WebComponents(4)DemoofFelix’sGithubrepo.

https://wpjs.co.uk/app/gutenberg/

TheycanbeusedinWPPHPpagesforcodemodularity:

https://wpjs.co.uk/app/wp-email-subscribe/ (mydemo)

Page 19: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WebComponents(5)

Example:<show-postid=“38”></show-post>

Ifwechangeid thisupdatesthepostused.Componenthas‘sealed’innerCSSWecanpassincustomCSSvariables

ExamplesofvarioustypesofComponents=>

Page 20: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WordPress

HTML

Framework...nFramework2Framework1

WEBCOMPONENTSWEBCOMPONENTS

<scriptsrc=“bundle.js”></script><divid=“app”>

Page 21: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

WordPress

HTML

Framework...nFramework2Framework1

WEBCOMPONENTS

WPComponents

<scriptsrc=“bundle.js”></script><divid=“app”>

WebComponents

WPPHPPAGESGutenbergBlocks

Page 22: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

InternationalJSConferenceLondon2018– KeyNoteSpeech

MULTI-FRAMEWORKCOMPONENTSTORE

LET’SBUILD‘ONESTOPWORDCAMPS’!

Page 23: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

MULTI-FRAMEWORKCOMPONENTSTORE

LET’SBUILD‘ONESTOPWORDCAMPS’!

Page 24: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

OVERLOADEDSLIDENEXTAjokefirst…

Heisenberggetsstoppedforspeeding…thepolicetellshim…

”Doyouknowyouweredoing103.5kmperhour?

”Damm.NowIdon’tknowwhereIam.”

Page 25: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

DisplayWordCampsfromWordCampCentral

Show/BookthatWordCampfromtheirwebsite

Cityknown:DISPLAYFLIGHTS

FlightBookingComponentCityisknown:DisplayHotelsHotelSelectedComponent

View/Book

Cityknown:CITYTOURGUIDE

Allindividualwebcomponentswithdifferent‘framework’.CommunicationviaCustomEventsandAttributes.

CentralStore:IndexedDB/ServerDB

ONESTOPWORDCAMPS

Page 26: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

INSTANT(WP)PAGES

§ HTTP1vsHTTP2§ CriticalCSS,CodeSplitting/Fonts,CDN§ ServiceWorkers,CacheAPI,IndexedDB– instantandoffline§ Browserhints:<linkrel=“dns-connext/preconnect/prepreload

/prerender/prefetch/>§ <portal>- ontrial,embeddednavigation§ IntersectionObserver API– ‘lazyloading’§ window.requestIdleCallback()– loaddataetc

Braintreats<100msas‘instant’,<1sas‘smooth’

Page 27: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

// Intercept URL request and handle…self.addEventListener('fetch', function(event) {event.respondWith(// search all cachescaches.match(event.request).then(function(response) {// if in cache use else go to network return response || fetch(event.request);}));

});

OFFLINE– SERVICEWORKERS

Page 28: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

Anotherwebsiteownersays:Ifyouprovidemewith§ AneasytodeployandusecomponentthatIcanconfiguretomyrequirements

§Whichprovidesrelevantandvaluablecontent§ Iwillpromoteyourwebsiteandservices/products

WP-HMTLprovidesonewayofdoingthisWithadditionalsideeffecttocreate‘instant’andofflinepages=>AcceleratedWordPressPages

SUMMARY(1)

Page 29: WordCamp Vienna 2020...We use JS to inject HTML into the tag, (Headless CMS), or render JSON data received, (Decoupled DMS). This was the basis of the Decoupled Site and this led to

CraigWestwp-html.co.uk

[email protected]

Emailmeforfree couponfordecoupledonlinecourse

SUMMARY(2)


Recommended