Andrés Smerkin

Andrés Smerkin

Information Systems Engineer. Developer at Riess Group. Husband and Father

Why to use a static site generator?

July 1, 2018

Recently I was trying to ease the way I manage some sites. I've realized that most of the times I create an entire Wordpress for a purely presentational website, or sometimes I use very few options, and it's a good plan to cut down features. After all, the only thing I need is to show some information, and that's all. A good case is this blog.

Why a static site?

Well, there are a good number of reasons, and this also depends on what you're trying to achieve. If you're selling a site to a client and he wants to customize and edit content, then probably a static generator is not a good plan. Otherwise, if you plan to create a simple and presentational website, or maybe a blog for yourself, and you will be the one editing the documents, then a static site can be a great idea.

Does this mean I have to code all pages individually?

No, you can use a tool to generate the static pages for you. You write your content in a format like Markdown, and then the generator automatically takes care of the static pages.

Some benefits of static site generators

  • Security: There's no admin panel or backend to hack. The server only replies with static content.
  • Faster times: When you use a backend language, like PHP, each request must be processed by the PHP interpreter before giving an HTML response. Some CMS also use caching plugins to generate the final static HTML on the fly, and they save it for a few requests more to the same resource. However, when you use static pages, the server directly replies with the already static content, meaning that the response is much faster.
  • Updates: With a static website you don't need to care much about plugin and theme updates. I mean, you can take care of keeping updated your static generator, but there are no vulnerabilities related to an exploit a plugin or theme adds to your website that can be used for crackers to get access to your server, etc.

Some drawbacks of static sites generators

  • You must have access to the code: The site es generated and published before moving the content to the server, so anyone updating the content must have access to the code. That's the way it works now. This may be complex for some people that wish an admin panel, like a typical Wordpress installation.
  • You need to learn a formatting parser, like Markdown: Yes, most of the times there are no WYSIWYG editors for this type of work. Well, you can use a 3rd party tool, like Ulysses, but most of the time you will only see text. I have to say that this helps to prevent distractions.

What static sites generator can I use?

There are plenty of generators out there. You can find one that best suits your needs, or maybe one that is written in a language you feel comfortable. My choice is to use Jigsaw because I'm a super pro Laravel developer 😆.