Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Serve Static Pages at Scale
Search
mouafa ahmed
November 21, 2017
Technology
0
51
Serve Static Pages at Scale
Serve Static Pages at Scale presentation from Static-Sites Meetup Berlin by Mouafa Ahmed
mouafa ahmed
November 21, 2017
Tweet
Share
More Decks by mouafa ahmed
See All by mouafa ahmed
User Experience 101
mouafa
0
100
Other Decks in Technology
See All in Technology
競技としてのKaggle、役に立つKaggle
yu4u
3
620
生産性向上チームの紹介
cybozuinsideout
PRO
1
870
EMとして2023年度に頑張ったこと / What we did well in FY2023 as a EM
pauli
1
170
本当のAWS基礎
toru_kubota
0
510
20240418_Google ColabにLLMが搭載されたようなのでPython x データ分析の勉強方法を考えてみる
doradora09
0
130
Databricks における 『MLOps』
databricksjapan
2
170
Kernel MemoryでAzure OpenAI Serviceとお手軽データソース連携
mitsuzono
1
240
ChatworkのSRE部って実は 半分くらいPlatform Engineering部かもしれない
saramune
0
160
コンテナセキュリティの基本と脅威への対策
kyohmizu
3
760
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
190
どうするコスト最適化のトレードオフ
tetsuyaooooo
1
510
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
120
Featured
See All Featured
KATA
mclloyd
15
12k
Making the Leap to Tech Lead
cromwellryan
124
8.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
17
6.4k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
14
1.6k
Infographics Made Easy
chrislema
238
18k
Producing Creativity
orderedlist
PRO
337
39k
Learning to Love Humans: Emotional Interface Design
aarron
267
39k
Gamification - CAS2011
davidbonilla
76
4.6k
Principles of Awesome APIs and How to Build Them.
keavy
121
16k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
221
21k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
6
1.5k
How To Stay Up To Date on Web Technology
chriscoyier
782
250k
Transcript
Serve static pages at scale Mouafa Ahmed
About me Mouafa Ahmed FE Tech Lead at Smartfrog @mouafa
2
3
The Challenge Imagine that your marketing team came to you
asking for: • A fast way to publish hundreds of landing pages. • Support of different languages. • The ability to change the content of those landing pages without your intervention. 4
5
6
A History of solutions • Python script that generate static
pages with all the available localisation. • Node.js script that basically do the same thing. 7
What we did right • Ability to handle many languages
• Putting content in Contentful • The ability to change the content without touching the code 8
What we missed • The ability to change the content
without redeploying • Mixing template with content in Contentful • A better Developer eXperience 9
10 Mixing template with content
Landing Pages Examples 11
12
13
14
15
What is Motor “MOTOR is a lightweight engine aimed to
rapidly build static pages” 16
17
section1 section2 section3 Template 18 Content
meta.json { "template": "ebook", "relations": [ { "contentfulID": "57tKmI41k4WQsUS28ckG0", "sectionID":
"section1" }, { "contentfulID": "1R3Eo49Ez6MeQYsUcoYCm", "sectionID": "section2" }, { "contentfulID": "59zeHjZ9QAcKyESsu4Iue", "sectionID": "section3" } ] } 19
Routing 20 lang-country FS path
meta path Motor Engine lang, country rendered page prerender render
Parse meta 21
Get Entries relations Motor Prerender Parse Entries Link Content Linked
Content 22
Prepare the local context (content + i18n + linker) content
Motor Render Resolve template Pug render With the prepared context rendered page template Lang, country 23
24
Environment variables NODE_ENV = development MOTOR_PORT = 4000 SPACE_ID =
contentful_SPACE_ID ACCESS_TOKEN = contentful_ACCESS_TOKEN 25
Configuration const motor = require('motor') const path = require('path') const
config = { path: { env: path.resolve(__dirname, '.env'), views: path.resolve(__dirname, 'views'), templates: path.resolve(__dirname, 'templates'), i18n: path.resolve(__dirname, 'i18n') }, static: [ { directory: 'static', path: path.resolve(__dirname, 'static') } ], supportedLangs: ['en', 'de'] } motor(config) 26
27
28 Thank You @mouafa