Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jekyll, minima: Using markdown for the homepage

I am building a static site using Jekyll and the Minima theme. I editing index.md changes the home page, but I see a strange comment on the top of the file:

---
# You don't need to edit this file, it's empty on purpose.
# Edit theme's home layout instead if you wanna make some changes
# See: https://jekyllrb.com/docs/themes/#overriding-theme-defaults
layout: home
---

Adding content below --- works. Obviously I'm not trying to change the theme, just add some content to the home page. Am I missing something?

Directory Structure:

index.md
_layouts
├── default.html
├── home.html
├── page.html
└── post.html

Is changing index.md the right way to add content to a Jekyll home page?

like image 253
Adam Matan Avatar asked Oct 29 '22 21:10

Adam Matan


1 Answers

Someone who is beginning with Jekyll could feel confused to see an (almost) empty index.md file. The key here is to know that it is using the home layout, located at _layouts/home.html and is where the code resides.

The above note just says that if you want to make some changes to the homepage, refer to the layout file, and not build the home page structure in that file.

If you add content below the second --- it will show up on home page because _layouts/home.html has {{ content }} in it.

Summarizing, if you just add some content and are happy where the template puts it, then you have nothing to change, if you want the content to appear anywhere else or change the structure, edit the template home.html file.

like image 63
marcanuy Avatar answered Nov 15 '22 07:11

marcanuy