Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,369 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,369 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,369 Points

No problem. Glad to help.

Jeff Lemay
Jeff Lemay
14,266 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!