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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
mouafa ahmed
November 21, 2017
Technology
0
61
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
120
Other Decks in Technology
See All in Technology
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
Cosmos World Foundation Model Platform for Physical AI
takmin
0
900
プロダクト成長を支える開発基盤とスケールに伴う課題
yuu26
4
1.3k
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
450
顧客の言葉を、そのまま信じない勇気
yamatai1212
1
350
今日から始めるAmazon Bedrock AgentCore
har1101
4
410
AWS Network Firewall Proxyを触ってみた
nagisa53
1
230
日本の85%が使う公共SaaSは、どう育ったのか
taketakekaho
1
210
データの整合性を保ちたいだけなんだ
shoheimitani
8
3.1k
20260208_第66回 コンピュータビジョン勉強会
keiichiito1978
0
140
コスト削減から「セキュリティと利便性」を担うプラットフォームへ
sansantech
PRO
3
1.5k
モダンUIでフルサーバーレスなAIエージェントをAmplifyとCDKでサクッとデプロイしよう
minorun365
4
210
Featured
See All Featured
GraphQLとの向き合い方2022年版
quramy
50
14k
The browser strikes back
jonoalderson
0
380
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
180
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
76
The Curious Case for Waylosing
cassininazir
0
240
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
430
Producing Creativity
orderedlist
PRO
348
40k
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
290
Why Our Code Smells
bkeepers
PRO
340
58k
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