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!

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 Introduction to HTML and CSS HTML: The Structural Foundation of Web Pages and Applications The Basic Structure of a Web Page

Question any help will be appreciated

when i make a project about websites and when i want to preview them it shows me a file tree, Sometimes the work spaces does that but i don't know why and i'd like to know why this happens when i preview a work space.

1 Answer

Dane Parchment
Dane Parchment
Treehouse Moderator 11,073 Points

This is can be for one of two (or both) reasons:

  1. You do not have an index.html file in your project's workspace. If you want a webpage to automatically load when you preview it (or go to its url) you need to have an index.html file because that is what the browser is looking to render first. If it doesn't appear then it shows you the directory structure of your website's server so that you can choose what you want to see.

  2. You have placed all of your files within a folder in your workspaces project. So instead of housing your index.html in the main workspaces directory you instead have them housed in another folder within your workspaces main directory. So when you preview it, the browser cannot find your index.html file and gives you options on what to choose.

Here is a workspace I created to show you how a project should be structured to avoid the directory being shown instead.

Here is a workspace that will show the directory because the index.html file does not exist.

Here is a workspace that will show the directory because the index.html file is not within the working directory (but when you click the directory it is in, the page will automatically display the index.html)

Hopefully that helped!

Thank you, Dave