Static sites are making a comeback. People are starting to see advantages such as speed and security.
Jekyll is a simple, blog-aware, static site generator that is distributed under an open source license. Once installed and setup it means there is no need to worry about security updates for your site.
Popular CMS's like WordPress and Drupal are often attacked by hackers. WordPress in particular has been subject to a number of attacks. There are usually patches made available quickly to plug up the hole. WordPress has made minor updates to its core automatic to help users keep up to date. Most WordPress sites use 3rd party plugins to extend functionality, so it is important to keep them up to date too.
Jekyll solves that issue by stripping away all that. It takes the engine off the web server. All the work on your computer. The only files that live on the server are the html and supporting CSS and media files.
Jekyll takes your source files and generates a whole static website. That site is then uploaded to the web server. It is fast and there is nothing to hack.
- Fast. There is no database backend to query. No templates to parse. Just the HTML. That makes it fast.
- Security. There is no login page. No backend manager. Nothing to break into. The HTML on the site is all there is.
- Host it anywhere. Jekyll only requires a host with a webserver. There is no need for a database. There is no need to worry if your web host is compatible.
- Can only be realistically managed by 1 person.
- Can have a large site that takes a long time to upload.
- Some people are put off by Ruby.
- Some people don't like markdown.
- It doesn't have a WYSIWYG editor.
- Doesn't feel as intuitive as using a CMS like Drupal or Wordpress.
- Jekyll is not officially supported on Windows (but there are workarounds)
Set up and running
Setting up a Jekyll site can be a bit daunting for the uninitiated. Once done, there is very little else that needs to be done. It involves the following steps
- Making sure Jekyll is installed on the chosen computer.
- Set up the Jekyll loops and configuration files.
- Creating the template files.
Once the set up is complete, the next step is writing the content and maintaining the site.
- Write the content.
- Compile it to a static site.
- Deploy to a server.
Updating and maintaining content.
Updating and maintaining content is relatively straightforward. You start your Jekyll server with the command "jekyll serve". Jekyll compiles the site to a directory called "_sites" and starts a temporary webserver, usually at http://127.0.0.0:4000
You then make the changes to your site. Jekyll generates the content and reloads a preview in the browser.
Once you've finished, upload the _sites folder to your webserver. This can be done with any FTP program.
Having said that, FTP can be quite inefficient because it uploads the whole file system. Spending time using rsync could make thing better in the long run because rsync only uploads the changed files. If you have a workflow based on a Node.js like Gulp or Grunt, you can integrate rsync into your workflow with Flightplan.js. Flightplan once configured will send your changes to the server for you.
The default setting for Jekyll is markdown. You can use plain html or jade with some changes. The default markdown is quite easy to learn. Once you've mastered it, it can be quite fast. You end up with nice clean HTML. It just requires a little bit of practice. Here are a couple of basics:
Paragraphs are a simple press of the enter key.
# This is an
* Item 1
* Item 2
Is Jekyll right for me?
- Small to medium sized website
- Only one person to maintain the site.
- The source files for the site live on 1 computer.
A small to medium sized business that has a few pages such as an about page and few services pages and a blog would be ideal. It wouldn't work on a larger site with lots of products or an ecommerce site. A small brochure site would probably be overkill.
- Jekyll site: http://jekyllrb.com/
- Setting up Jekyll on Windows: http://jekyll-windows.juthilo.com/
- Jekyll Tips: http://jekyll.tips
- Markdown: https://guides.github.com/features/mastering-markdown/
- Flightpln.js: https://www.npmjs.com/package/flightplan