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.
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
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.
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.
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
octopress and start blogging using mardown! I will be adding another tutorial showing you how to install and configure
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
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
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.
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.