Intermediate Topic 33 of 51 Web Development
Static Site Generation
Prebuilding pages at compile time.
How it works
Static site generation builds pages into plain HTML, CSS and JavaScript files at build time from templates, Markdown and data sources, then serves them from a CDN with no server-side computation per request. Tools include Hugo, Jekyll, Eleventy, Astro and Next.js static export. Incremental static regeneration rebuilds pages on demand or on a schedule, and dynamic parts can be added with client-side JavaScript or APIs.
Step-by-step walkthrough
- Content lives in Markdown or a CMS.
- At build time a tool renders every page to HTML.
- The files are uploaded to a CDN.
- Visitors get instant responses.
- No server runs per request, but changes need a rebuild.
Where it is used
Blogs, documentation, marketing sites, portfolios and product catalogs benefit from fast loading, cheap hosting, security and easy caching.
Common pitfall
Content changes require a rebuild and deploy, which can be slow for very large sites. Personalized or real-time data needs client-side fetching or serverless functions. Preview workflows for editors take setup. Stale pages can persist in caches. Pick static generation for content that changes infrequently and hydrate only the interactive parts.
Where it fits in the course
Static Site Generation is topic 33 of 51 in Web Development, rated Intermediate. It follows Server-Side Rendering. The next topic is Backend Basics.
Practice and explore
- Open the interactive lesson, with a mini quiz.
- Take the Web Development quiz.
How to study this topic
- Read the explanation above and restate the definition in your own words.
- Open the interactive lesson and answer its mini quiz.
- Read the common pitfall, then write a short example that avoids it.
- Check your understanding in the Web Development quiz, and revisit the topic if you miss a question.
Frequently asked questions
What is Static Site Generation?
Where do people use Static Site Generation?
What is the most common mistake with Static Site Generation?
What should I learn before this topic?
How can I practice it?
Is Static Site Generation hard to learn?
How long does it take to learn Static Site Generation?
Which topics are related to Static Site Generation?
What should I study after Static Site Generation?
Related topics
- Server-Side Rendering (Web Development)
- Backend Basics (Web Development)
- Build Tools and Bundlers (Web Development)
- Node.js (Web Development)
- Static vs Dynamic Typing (Languages & Compilers)
- Cross-Site Scripting (Security & Cryptography)
- Static Single Assignment (Languages & Compilers)