Jekyll in action

Jekyll is a free, open source, static site generator written in Ruby by Tom Preston-Werner, GitHub’s co-founder. Website created in Jekyll can be hosted on platforms like GitHub or Google Firebase. It’s commonly used by bloggers with experience in programming.

 

WTF is Jekyll?

3083652Jekyll is a free, open source, static site generator written in Ruby by Tom Preston-Werner, GitHub’s co-founder.  Website created in Jekyll can be hosted on platforms like GitHub or Google Firebase.  It’s commonly used by bloggers with experience in programming.

Jekyll is different than Content Management Systems like WordPress. It doesn’t have build in graphical interface, but it can be implemented(more about this later).

Instead of using databases, Jekyll takes the content, renders Markdown or Textile and Liquid templates, and produces a complete, static website ready to be served. Writing page from scratch can be challenging, but Jekyll have countless themes available online:

If you want you can buy themes on Market.envato.com.

Advantages of Jekyll

Jekyll is fast. Faster than any WordPress site. Static website once is generated it can not change. It doesn’t require connection to a Database what makes it super fast. Loading speed can be effected by things like large images, this is factor to look out for.

Jekyll is Simple. Jekyll doesn’t add any bloat to the website or blog you are working on. Many of the Jekyll Themes are very minimal and content oriented. take a look at Netflix website powered by Jekyll.

Jekyll is secure. Static websites will not have any database to manipulate. So Jekyll a 100 times safer than WordPress. But nothing is un-hackable. Not having database makes it easier to use for people with no experience in Back-end development.

Installation

Installation is one of the trickiest things in Jekyll. Jekyll is based on Ruby  and it require few things to run:

  • Ruby (including development headers, v1.9.3 or above for Jekyll 2 and v2 or above for Jekyll 3)
  • RubyGems
  • Linux, Unix, or macOS
  • NodeJS, or another JavaScript runtime (Jekyll 2 and earlier, for CoffeeScript support).
  • Python 2.7 (for Jekyll 2 and earlier)

After meeting all the requirements you can install it like any other Ruby Gem:

$ gem install jekyll

Installation process was greatly explained in many articles in the past, more information about the installation process you can find on official documentation:

This works only if you are Mac/Linux user. If you are Windows user it’s little more complicated…

 

Hosting

octojekyllGitHub gives option to host static websites for Free including domain based on the account name. GitHub Pages are public web pages for users, organisations, and repositories. GitHub Pages are powered by Jekyll behind the scenes, so in addition to supporting regular HTML content, they’re also a great way to host your Jekyll-powered website for free.

Tutorial explaining this process can be found on GitHubSupport page

Jekyll comes with plugin for importing content from WordPress.com.

CMS

Creating posts in Text Editor with Markup language and generating new website with each update can be frustrating. Companies like CloudCannon.com offer solution to this problem. Using CMS gives you or your client direct access to the server and option of editing the page and adding new content really easy without and technical knowledge. However basic account costs 25$/month.

Alternative option is provided by SiteLeaf. Another option for personal use is free Prose.io

Conclusion

This post is a beginning of new series of articles about web development. If you are looking for more unique way of blogging this can be option for you. However it requires a knowledge of  front end development and it can be too complicated for people not familiar with web development. This can be simplified with CMS’s for small monthly fee. I hope this article was helpful and now you have new tool under you belt.

Here is example of my Portfolio website built with Jekyll.

 

 

C# Statics

Static keyword is used to access the method or variable without creating instance of the class. Static effectively  means “associated with a type instead of any one instance of the type”. This keyword can be used in multiple structures. IN this article i’ll focus on static keyword used with methods, classes and variables. First lets take look at variables.

Static Variables

Static variables allows to access the values from other class,if its public, without creating the instance of the object.

In My example use MyClass to store two static fields with initial values. I can acess those variabels from Program Class. I dont need instance of the class to call the variables.

class Program
{
  static void Main(string[] args)
  {
      Console.WriteLine(MyClass.i.ToString()+" "+MyClass.name);
  }
}

class MyClass
{
  public static int i=0;
  public static string name="John";
}

Static  Methods

To call static method we don’t need  an instance of the class—this makes them slightly faster. Static methods can be both public or private.  A static method cannot access non-static class level members. It has no “this” pointer. We can not refer to non-static fields from static method.

This is modified version of previous example. This time I have just one static method in MyClass. I’m calling this method from Program class without creating the instance of an object.

 

class Program
{
  static void Main(string[] args)
  {
      MyClass.Print();
  }

}
class MyClass
{
  public static void Print()
  {
     Console.WriteLine("This is Static method");
  }
}

 

Static Classes

A static class is never instantiated. The static keyword on a class enforces that a type not be created with a constructor. Class with static keyword can not have any instances.This eliminates misuse of the class.

A static class is a class which can only contain static members. Like variables and methods from previous examples.

static class MyClass
// Line below can not be executed. 

// MyClass a = new MyClass();

Now you know the basic implementation of static keyword it can be useful when working with large and complex projects whits a lot of connections. Statics can improve the performance and make variables/methods easier to access. In my Unity Tutorials I’ll demonstrate the use of statics in real word examples. Stay Awesome!