0
votes

I'm trying to change my github pages Jekyll index.html

--- layout: default ---
{% for post in site.posts %}
{{ post.title }}
{{ post.excerpt }} 
Read More 
{% endfor %} 

to

--- layout: default ---
{% for post in site.posts %}
{{ post.title }}
{{content}} 
Read More 
{% endfor %} 

so the entire post shows up on the homepage.

When I run jekyll serve I don't get what I want

pic

However, the strange thing is that when I edit the index.html back to it's original content, I still get the wrong output

pic2

Editing the index.html in my Jekyll folder is breaking everything, what's going on? The only way I can get the site to work again is to delete index.html and replace it with a copy of the original.

I should point out that the index.html file I'm editing is the same folder that contains the _site, _posts folders.

2
Try to build your site first using this command jekyll build --watch from the terminal. - ismnoiet
Tried it, didn't work - Ryan Halabi
Try putting the --- on separate lines. - alykhank
Tried it, didn't work - Ryan Halabi
Make sure that you have all required gem packages installed by issuing this command in your jekyll site folder : gem install. - ismnoiet

2 Answers

2
votes

According to the Jekyll Docs, your front matter should be surrounded by --- on separate lines. Your file likely isn't being parsed since it is all on a single line, try this instead:

---
layout: default
---
{% for post in site.posts %}
{{ post.title }}
{{content}} 
Read More 
{% endfor %}
-1
votes

I have solved the problem!

Instead of using gedit or vim, like a novice I used TextEdit. If you type '---' in TextEdit you'll observe that it converts the first two dashes into a single long dash character (although in the screen caps it still looks like 3 dashes...)

Switching to vim fixed it.

Update: Out of curiosity I edited index.html in TextEdit, then opened it in vim. The file was completely different, so TextEdit introduces more significant changes then altering a few dashes.