From the course: Learning Static Site Building with Hugo

How static sites work

From the course: Learning Static Site Building with Hugo

Start my 1-month free trial

How static sites work

- [Instructor] In this course we'll be building something called a static site. First let's define what it means for a website to be a static site. A static site only includes content that can be loaded from a file, things like HTML, CSS, JavaScript and images. This type of content which is stored directly and delivered verbatim from the server is called static content. A static site doesn't include any dynamic content or things that can change on the fly or be generated by server code. This means that you can't use server code to render content or pages. The difference could be illustrated by comparing static sites with a popular site platform like WordPress. Tools like WordPress, Drupal, Joomla and Umbraco are called content management systems or CMS. CMS like WordPress are a popular choice for building websites and blogs because they make it easy to publish the site without having to build it from scratch. However CMS do have some down sides. Let's take a look at how WordPress handles an incoming request and delivers a page to the browser. First someone uses their browser to request a page from your website. The WordPress code running on your server sees that incoming request and looks up the content for that page in a database that's running on that server or maybe somewhere else. After retrieving that raw content the WordPress engine applies templates, injects plugins and other add ons and performs a number of processing steps on that content, which eventually results in an HTML page that's pushed back down to the browser. This works but it can be slow, especially if the server you're on isn't very powerful. Let's compare that with how a static site works. With a static site all of the sites pages and content are pre-built and stored as simple files directly on the web server. When the browser requests a page the server simply serves those files directly. This makes static sites incredibly fast. I'll cover some of the other advantages of static sites next.

Contents