In a previous post about Jekyll we saw how to install Jekyll on both the server and a personal computer. This article will explain the basic structure of this platform as well as its directory hierarchy.
_includes
This directory contains all the HTML files that our page relies on. For example, if our page displays a notice to accept the cookie policy, this html would go in this directory along with the JavaScript file (if needed).
This folder also commonly contains elements shared by all the pages on our website. For example, the header and footer (named header.html and footer.html by default).
_layouts
This contains the different layouts for each page that makes up our website. For example, if our website has a home page (they all do) and several pages for blog posts, it makes sense to create an html template shared by all posts and then read the contents from different text files (which are always easier to write in than html) in MarkDown(.md) format.
_posts
This directory holds the different articles or subpages on a website. This is very useful for a blog, for example, as described above. Each entry corresponds to a .md file, which by convention has the following name: AAAA-MM-DD-nombre-del-articulo.md , where AAAA-MM-DD is the date it was written in English format.
Each .md file usually starts with a header so that it appears in the html and adds functionality to the page, such as creating tags: Here, layout refers to the template previously defined in _layouts; title is the title, description its description, modified the date shown to visitors in English format, category the main category, and tags the tags.
—layout: post (lo habremos definido en _layouts)title: ¡Hola Mundo! (título) description: “Este es el primer artículo de una serie de 100” (descripción del mismo) modified: 2017-08-14 (fecha que se mostrará a los visitantes, formato anglosajón)category: linux (categoría principal)tags: [Arch, linux, OpenSource, LXDE] (etiquetas)—
_site
This folder is created automatically by jekyll, and modifying it is not recommended. Any changes we want to make can be made in our project's root directory.
_drafts
Similar to posts, but only for drafts (unpublished articles).
Root directory
In this directory (outside all the folders mentioned), you can create more files or subpages, among which the following are required:
- index.html
This is our program's home page. It normally uses different layouts components to keep the project better organized. - _config.yml
This file is the most critical and fundamental part of our page. Without it, our website will not work. It manages the different subpages and contains all the configuration information. We can also add all the constants that we can use across all the subpages, for example, the Google Analytics id.
The most common tags are:
layout: post (lo habremos definido en _layouts)
title: ¡Hola Mundo! (título)
description: "Este es el primer artículo de una serie de 100" (descripción del mismo)
modified: 2017-08-14 (fecha que se mostrará a los visitantes, formato anglosajón)
category: linux (categoría principal)
tags: [Arch, linux, OpenSource, LXDE] (etiquetas)It is common to see many more tags, but that will depend on the theme we are working with.
David Población Criado, a Computer Engineering and Statistics student at the University of Valladolid.