Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML Build a Blog with Jekyll and GitHub Pages Building and Customizing the Blog Creating Pages

Bruce Caraway
Bruce Caraway
5,961 Points

Why do we want to create a folder for each page (i.e., Resources or Contact) with an index.html file inside?

As I understand it, there will now be a folder for each page, so in the example, our site would have a folder for each page (about, contact, and resources) and then inside of each folder, there is a file named index.html.

Why wouldn't I just have a file for each instead, i.e., about.html, contact.html, and resources.html)

This just seems extraneous.

2 Answers

Samuel Webb
Samuel Webb
25,370 Points

I don't know anything about Jekyll, but usually you would do this to clean up your URLs. By doing this, to get to the contact page you'll be able to go to website.com/contact and it will automatically open up the index.html file, but it won't show it in the URL bar. If your file is in the root directory and its called contact.html, you'll have to go to website.com/contact.html to get to it. Cleaner URLs are better for SEO and when people are trying to type in a specific page on your site.

Samuel Webb
Samuel Webb
25,370 Points

Yea pretty much what Jeff said.

Bruce Caraway
Bruce Caraway
5,961 Points

That definitely makes sense now - before looking at Jekyll most of my experience has been with WordPress which handles the pretty permalinks for me. Now I see the difference - thanks!

Samuel Webb
Samuel Webb
25,370 Points

No problem. Glad to help.

Jeff Lemay
Jeff Lemay
14,268 Points

Each file having it's own folder allows for clean URLs. Like mysite.com/about/ instead of mysite.com/about.html

EDIT: Because when you go into a folder with no specific file referenced, your browser looks for an index file and opens that automatically (like a homepage for that folder)

Bruce Caraway
Bruce Caraway
5,961 Points

Ah, yes I see now...makes sense.

Thanks for the help!