Why you should have a static website

If you are running a personal website and a blog it is likely that you don’t require a dynamic website or a database. You might think that by having a dynamic website it would make your life a lot easier. This might not be the case in reality.

A Typical Example

You have a website that has some details about you, has some pictures and may be a blog. You might be using a single content management system (CMS), such as Wordpress, for all these . However, when you use wordpress your website is dynamic.

What does this mean? Well, simply put every time a visitor comes to your website your web server (this could be apache, nginx, node.js etc.) calls a script that does a database look-up for the content to serve to the users and returns the content as HTML back to visitor’s browser.

However, in most cases your server can perform better if it can server static content. This means your server can just get corresponding HTML files and return to the visitor’s browser rather than performing a database query. This is often done by creating cache files and the script returns the cache file contents. This is still an expensive (read cpu intensive) way to go about it.

In most cases you can in fact generate the corresponding HTML files when you generate the content and your web server can serve these files. I know some of you will have questions if you can do this efficiently, so let’s move on to those questions.

Generating HTML files

There are many ways to do this. So let me explain what I have done with this website. This blog is essentially serving HTML files.

I use Jekyll to generate the HTML files.

You can install Jekyll on Linux, Mac and Windows operating system. (Please note that I have not tried this on a Windows machine but I assume it would work in a similar fashion.)

In order to blog using Jekyll you need to have ruby installed so that you will have assess to gem. You also would require bundler to install packages efficiently.

Then you can proceed to install Jekyll and octopress and start blogging using mardown! I will be adding another tutorial showing you how to install and configure Jekyll soon.

Plugins & Add-ons

There are lots of plugins you can use with Jekyll. If you used to the Wordpress or Drupal environment, then you will see that in Jekyll you can have add-ons and themes to customise your blog.

If you know HTML you can simply edit the layouts without having to learn any programming language (well, I should emphasis that there are experts who argue that HTML is in fact a programming language - check out this video

How about dynamic features of the website?

There are features that require a dynamic environment. For example, you may have to have a comment section for you blog. You may need a script to send emails when a website visitor fills you contact form.

There are ways to get around this. You can use disqus for commenting (and you can do this by adding javascript to your HTML file). OK, what about forms? Well, you can simply submit your form to a single script file which will handle the form processing part. You can use the following script if you would like to process forms and send emails to your email address from your website using SendGrid.


    // load the library
    require 'SendGrid_loader.php';
    // replace these values with your credentials
    $sendGrid = new SendGrid\SendGrid('your_username', 'your_password');
    $mail = new SendGrid\Mail();
    // add validation before passing request
    $mail->addTo([email protected]')
        ->setFrom([email protected]')
        ->setSubject('Message from ' . $_REQUEST['email'])


If you would like to completely avoid server side scripts you can use third party service that are available for free. For example, you can use Google Forms to generate forms and Google will process and store the data for you. You can even use a custom HTML form and simply submit it to Google Forms for processing. I will be adding a tutorial showing you how to do this soon.

Now you know how to setup a complex website / blog using static files I encourage you to give it a go and see how the performance improves. This will also allow you to use less system resources and host a powerful website/blog without a database.