Before setting up Jekyll, we need to understand its primary application. As we have already discussed in the introduction that Jekyll is a static site generator. Let us discuss for a bit what is it all about, how sites actually work.
When we tell our browser to open a link, it starts downloading the webpages.
So for example, when you open a Wikipedia page, it actually first download the page, and then shows it to you.
These downloaded data includes the page source code, images, icons, libraries, everything that you see.
Now how these data are served? The browser requests a server to provide the resources and files for a particular web page. Based on that request, the server thinks, does stuff, and provide response.
Now this server can provide resources in two ways.
First is, dynamic approach.
Suppose you want to make open your Facebook settings page. Now, the browser will request the Facebook to provide that page.
Here is an intelligent process. Facebook first will check if you are the real owner of the account, if you are logged in, and then, it will provide only your settings page.
Another feature of the dynamic site is when you save settings, not only it provides data but also takes data from you and save the new changes into its own servers. So they also handle data.
Hence sites like Facebook, YouTube are dynamic. Here we have login logout stuff. They decide intelligently what to give and what to take.
As users can put data into their sites, they can be easily hacked.
On the other hand, there are static sites. static sites doesn’t take any data from you to save, and nor it provides any data intelligently.
When the browser request any data, only one of the two things occur.
- Either data is not available, so a 404 error is returned.
- If it is available, then it is immediately provided.
Sites like fuddlepixel.com is a static site. As there is no decision-making process, and no data input, static sites are faster, secure. But it cannot do things like social network, commenting system, login logout, saving data etc on its own.
Time to go Hybrid
Now a days, we mostly use hybrid approach. For example, as I said, commenting system is a dynamic thing. But this site static. Did you notice below there is a Disqus comment box? So this is the hybrid way.
Of course, this site is static. I don’t care about server, database, hacks etc. This site is simply a generated pile of HTML files by my custom Jekyll Configuration.
And then, it has Disqus commenting system. This website is not offering it. I am using this as a third-party plugin from Disqus.
Similarly, even if this site is purely static HTML, I can easily analyze the traffic live as I am using google analytics from Google.
So we can keep sites statics while using third-party tools for dynamic needs.
In this series about learning Jekyll, we will build static sites while using useful third-party tools for dynamic needs. A good Jekyll site must be like that.
Meanwhile, enjoy learning programming from zero at fuddlepixel.com.