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
仕様書駆動AI開発の実践: Issue→Skill→PRテンプレで 再現性を作る
knishioka
2
660
こんなところでも(地味に)活躍するImage Modeさんを知ってるかい?- Image Mode for OpenShift -
tsukaman
0
140
SREが向き合う大規模リアーキテクチャ 〜信頼性とアジリティの両立〜
zepprix
0
450
顧客の言葉を、そのまま信じない勇気
yamatai1212
1
350
AI駆動PjMの理想像 と現在地 -実践例を添えて-
masahiro_okamura
1
120
FinTech SREのAWSサービス活用/Leveraging AWS Services in FinTech SRE
maaaato
0
130
生成AIを活用した音声文字起こしシステムの2つの構築パターンについて
miu_crescent
PRO
2
200
SRE Enabling戦記 - 急成長する組織にSREを浸透させる戦いの歴史
markie1009
0
120
Codex 5.3 と Opus 4.6 にコーポレートサイトを作らせてみた / Codex 5.3 vs Opus 4.6
ama_ch
0
150
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
AWS Network Firewall Proxyを触ってみた
nagisa53
1
230
Ruby版 JSXのRuxが気になる
sansantech
PRO
0
150
Featured
See All Featured
Prompt Engineering for Job Search
mfonobong
0
160
The Limits of Empathy - UXLibs8
cassininazir
1
210
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
75
Music & Morning Musume
bryan
47
7.1k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
It's Worth the Effort
3n
188
29k
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Marketing to machines
jonoalderson
1
4.6k
Accessibility Awareness
sabderemane
0
51
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
55
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
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