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
59
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
110
Other Decks in Technology
See All in Technology
Enhancing SaaS Product Reliability and Release Velocity through Optimized Testing Approach
ropqa
1
230
Glacierだからってコストあきらめてない? / JAWS Meet Glacier Cost
taishin
1
160
Zero Data Loss Autonomous Recovery Service サービス概要
oracle4engineer
PRO
2
7.8k
敢えて生成AIを使わないマネジメント業務
kzkmaeda
2
450
DatabricksにOLTPデータベース『Lakebase』がやってきた!
inoutk
0
110
Sansanのデータプロダクトマネジメントのアプローチ
sansantech
PRO
0
160
Reach American Airlines®️ Instantly: 19 Calling Methods for Fast Support in the USA
flyamerican
1
170
AI時代の開発生産性を加速させるアーキテクチャ設計
plaidtech
PRO
3
160
Should Our Project Join the CNCF? (Japanese Recap)
whywaita
PRO
0
340
Geminiとv0による高速プロトタイピング
shinya337
1
270
Model Mondays S2E04: AI Developer Experiences
nitya
0
140
SmartNewsにおける 1000+ノード規模 K8s基盤 でのコスト最適化 – Spot・Gravitonの大規模導入への挑戦
vsanna2
0
140
Featured
See All Featured
Mobile First: as difficult as doing things right
swwweet
223
9.7k
A Modern Web Designer's Workflow
chriscoyier
695
190k
Become a Pro
speakerdeck
PRO
29
5.4k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
20
1.3k
[RailsConf 2023] Rails as a piece of cake
palkan
55
5.7k
Into the Great Unknown - MozCon
thekraken
40
1.9k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
20k
Music & Morning Musume
bryan
46
6.6k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Navigating Team Friction
lara
187
15k
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