--- layout: step title: Blogging position: 8 --- You might be wondering how you can have a blog without a database. In true Jekyll style, blogging is powered by text files only. ## Posts Blog posts live in a folder called `_posts`. The filename for posts have a special format: the publish date, then a title, followed by an extension. Create your first post at `_posts/2018-08-20-bananas.md` with the following content: ```markdown --- layout: post author: jill --- A banana is an edible fruit – botanically a berry – produced by several kinds of large herbaceous flowering plants in the genus Musa. In some countries, bananas used for cooking may be called "plantains", distinguishing them from dessert bananas. The fruit is variable in size, color, and firmness, but is usually elongated and curved, with soft flesh rich in starch covered with a rind, which may be green, yellow, red, purple, or brown when ripe. ``` This is like the `about.md` you created before except it has an author and a different layout. `author` is a custom variable, it's not required and could have been named something like `creator`. ## Layout The `post` layout doesn't exist so you'll need to create it at `_layouts/post.html` with the following content: {% raw %} ```html --- layout: default ---
{{ page.date | date_to_string }} - {{ page.author }}
{{ content }} ``` {% endraw %} This is an example of layout inheritance. The post layout outputs the title, date, author and content body which is wrapped by the default layout. Also note the `date_to_string` filter, this formats a date into a nicer format. ## List posts There's currently no way to navigate to the blog post. Typically a blog has a page which lists all the posts, let's do that next. Jekyll makes posts available at `site.posts`. Create `blog.html` in your root (`/blog.html`) with the following content: {% raw %} ```html --- layout: default title: Blog ---{{ post.excerpt }}