vueschool.io
Rolf Haug
Teacher @ Vue School
Full Stack developer
Consultant
Foodie 🌶
Oslo, Norway
Alex
Kyriakidis
Teacher @ Vue School
Author of The Majesty of Vue.js 1 & 2
Vue.js Contributor
Consultant @ RxVantage
Amsterdam
Learn Vue.js through video courses
235 lessons • 49.000+ users
@vueschool_io
@vueschool_io
Static Site Generation
🛠
@vueschool_io
Side effects
Of modern JavaScript frameworks
@vueschool_io
Jumping Content
When a page layout changes or shifts unexpectedly
@vueschool_io
Ajax partials are loaded asynchronously
What causes the side effect?
@vueschool_io
Commonly seen
with Ads
@vueschool_io
Happens with any content that is loaded after initial render
@vueschool_io
It's annoying to click the wrong button!
@vueschool_io
Fetching async data from API's is common & necessary
@vueschool_io
A User Experience Issue
Not the end of the world 🤷♂️
@vueschool_io
Another,
more serious
side effect...
@vueschool_io
Search engines struggle to index many JavaScript powered sites
@vueschool_io
@vueschool_io
@vueschool_io
SPA vs Static Pages
- Easier to index & crawl
- Hidden and visible content is available on initial render
@vueschool_io
Crawlers get all the information they need to index it right away
@vueschool_io
Search Engines
-
Get the content available on the initial render
-
Simulate a browser
-
Run the JavaScript
-
Index the page
@vueschool_io
Requires significantly more computing power
@vueschool_io
Googlebot defers indexing of JavaScript powered websites
@vueschool_io
Oh mighty Google is putting us on hold...
...until they have the capacity to index our sites
@vueschool_io
Googlebot uses Chrome 41
Fun Fact
-
Released in 2015
-
Does not support ES6
-
I am running Chrome 72
@vueschool_io
Indexing JavaScript apps is not an easy task for crawlers
Make no mistake!
@vueschool_io
The indexing issue
is serious
Lack of being indexed can
make or break businesses
@vueschool_io
What can we do?
@vueschool_io
Server Side Rendering
Render a website with components and assets into HTML before it's sent to the browser
@vueschool_io
Server Side Rendering
-
Solves the page jumping
-
Makes our website indexable
-
Increases performance
@vueschool_io
Server Side Rendering
is great
But!
@vueschool_io
We can go completely static
@vueschool_io
Pure static HTML files do not need a server
@vueschool_io
Thanks to awesome companies like Github and Netlify
Free hosting 🎉
@vueschool_io
How does it work in practice?
@vueschool_io
StaticGen.com
High Level SSG
-
Parse your config or routes
-
Render your app
-
Store the output in static files
@vueschool_io
Keep our modern workflow
Add a Static Site Generator top
Get a static version
@vueschool_io
Static sites are *not* the new cool kid on the block!
Text
@vueschool_io
Static Site Generators are awesome
They help us solve some of the challenges we face with modern frontend technologies
and frameworks today
@vueschool_io
User Experience 🤓
We reduce the shifting layout issue
@vueschool_io
SEO 🔍
Pre-rendering improves indexability and helps social media crawlers, chat services, etc.
@vueschool_io
Performance 🏎💨
Nothing beats static sites when it comes to performance
@vueschool_io
Hosting 🏝🌤
- Cost of hosting
- Hosting on Content Delivery Networks
- Easy to set up, manage and scale
@vueschool_io
Security 👮♂️
Articles and experts claim that static sites are more secure
@vueschool_io
Glorified security statements?
🤔
-
Less moving parts
-
A server less to maintain
@vueschool_io
A CDN will handle DDos attacks for you
✅ A very nice-to-have security perk
@vueschool_io
What about rich static sites?
There is still an API or server
somewhere
@vueschool_io
Do we really get rid of the security concerns?
-
SQL Injections
-
Serverside Security holes
-
Cross-site scripting (XSS)
@vueschool_io
🙈
Or do we just move them?
@vueschool_io
Perfect Use Cases
-
Business website
-
Blog
-
Portfolio
-
Presidental Campaign
@vueschool_io
Obama's 2012 Campaign
website was built Jekyll
Raised over $250 000 000
0% Downtime
@vueschool_io
Static Site Generation
is awesome
Demo time!
@vueschool_io
Static Site Generation is Awesome
By Rolf Haug
Static Site Generation is Awesome
RAH
- 71