How to blog with Jekyll

octojekyll

Whether you want to learn how to create a blog, or you would like to write something in particular, it is true that maintaining a blog takes time and money, but there are still free and open source tools that will save you a lot of things and that they make you just write.

I will teach how to use Jekyll for its ease and use of Markdown, and while there are many alternatives, Jekyll interacts well with Github.

Requirements:

  1. Time
  2. Internet
  3. Github account

Installation

On Debian / Ubuntu and derivatives:

sudo apt-get install git ruby ​​jekyll

On Fedora and derivatives:

sudo yum install git ruby ​​gem install jekyll

In Arch and derivatives (patience):

sudo pacman -S git ruby ​​yaourt -S ruby-jekyll

Base Configuration:

We configure git with our Github data

git config --global user.name "username" git config --global user.email "email_id"

We create the git repository in which we will work locally, must be called same as your username on Github

git init youruser.github.io

Once the blog directory is created we have to search a topic for jekyll in, or failing to create one. Then you must copy the content of the theme to the directory created with git, in the example use the Compass theme

In this directory you will find several files and directories, although the theme may be organized differently, most use this organization format

/ _includes Directory of the body of the page
/ _layouts Directory of the body of the page
/ _posts Directory where the entries go
/ _css o / scss Directory where the css are
/ _img o / images Directory where the images go
/_config.yml The configuration file
/404.md The 404 error page
/ CNAME Link to a domain
/about.md The page «about»
/index.html Home page

Now complete the _config.yml configuration file with the data you prefer, in my case I left it like this:

-_config.yml (~ -Blog-desktop) - gedit_003

Go to the terminal in the directory we work with and write

jekyll serve

From a browser enter localhost: 4000 or 127.0.0.1:4000 and you will see the site working, you can start modifying the blog content locally through your preferred code editor, mine is sublime text.

Compass

Here Jekyll with the theme already installed.

When you decide that the blog is ready to be published, or to update the entries write

git add --all git commit -m "Message you want to show" git push -u origin master

It will ask for your github username and password; write it and access

www.youruser.github.io

Well up to here the entry, I hope it has been clear. The tool StackEdit allows you to write and export the markdown files to a github repository, if you need information from jekyll you can use the jekyll official website or from the github pages help page.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   elav said

    Good article, but there are many other CMS or web applications for creating blogs that really do make you focus on writing. I see too difficult to use Jekyll, although for tastes ..

    1.    dhunter said

      The sexappeal of Jekyll, Pelican and others is the fact that they generate static sites from Markdown RestructuredText or etc, and thus you create blogs that can be hosted on github pages and put external comments with Disqus.

      My blog is Pelican for example, to create a new post is to create an rst file and recompile, I commit to the gh-pages branch of the repo in github and that's it.

      1.    elav said

        Uff, super easy right? Create a file, recompile, commit .. There is WordPress (and similar), every day I love you more 😛

      2.    dhunter said

        As a curious fact kernel.org uses a generator of these.

        https://www.kernel.org/pelican.html

    2.    oneohthree said

      Well, they are two different things, but I would completely change WordPress for any static website builder. The complication is at the beginning, when you have to assemble the layout and others, the other thing is precisely what you say, concentrate on writing, you simply generate a plain text file and with markdown BAM you create the post. I don't see anything complicated in it.

      regards

      1.    elav said

        I am not saying that is your case, but some have waged a holy war on WordPress (such as Joomla or Drupal) in favor of static content generators. Yes, they are fast, they are simple, but they are more problematic when it comes to doing what WordPress does, and that is not to mention the tool as something collaborative, where many can participate, where you have to moderate ... etc.

      2.    andrew said

        You are right elav, wordpress is better, depending on the needs. a blog like desdelinuxIt could work with a static content generator but for many people to participate it would be a problem, in addition to the fact that although it is easy to configure it may have security problems, not like WordPress. That is why for newbies I recommend Jekyll then Wordpres since it is easier and you can learn with simple tutorials in HTML/CSS without using PHP that would scare a newbie.

    3.    andrew said

      This I wrote is the same technology that github pages uses, but it doesn't allow you to use your own themes, you have to use the default ones. Of course there are more easy ones, but I was looking for simple installation and configuration without having to work on Domains, Hosting, SEO, Security, etc.

    4.    There Day said

      It took me a long time to create it with wordpress, but I'm going to try it, thank you very much I share your article 🙂

  2.   MD said

    But… one question… Isn't it a blog?

    It is a flat page, because it does not allow comments.

    1.    Jesus Ballesteros said

      Let's say it's technically a static page. But if it allows you to install Disqus for the comments so there it would complement what is needed.

      1.    MD said

        Interesting, thanks.

  3.   Oscar said

    Thank you. Very good.