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 trialDave Lawlor
2,732 PointsPreview Workspace displays Index of/ rather than my name.
Hi everyone
I've just begun - the preview brings up a directory tree structure listing Index.html rather than the content (my name). I've tried using notepad and this works as expected in both IE and Firefox.
Could anyone suggest what the issue might be?
Thanks very much.
4 Answers
Dave McFarland
Treehouse TeacherHi Dave Lawlor
Yes, that's how Workspace previews work. Workspaces provides an actual web server environment -- it's not like opening a file off your hard drive in a browser; it's like typing in a URL in a web browser to view a page.
If you put the index.html file in the TOP folder in your workspace, opening the preview will open that file. However, if the index.html file is INSIDE another folder, you will see the directory listing like you are getting.
To move the index.html file to the top level in your workspace, you drag the file DOWN to the bottom of the file listing until the top level folder highlights. I know this is the OPPOSITE of what you'd expect to happen, but you can't just drag the file into that top level folder.
Eventually Workspaces will work with server side programming as well like Rails and PHP. In those environments you don't preview the file you're currently working on. For example, in WordPress, you access the site through the index.php file in the root. So when previewing a site like that you WANT to open in the root folder.
Hope that helps.
Dave Lawlor
2,732 PointsHi Dave
My last on this - I promise:
If you look here:
@ 4mins 29 secs you can see how Nick's workspace is showing the index.html file.
All the best
Dave.
Dave McFarland
Treehouse TeacherHi Dave (great name, by the way)
The default folder -- "How To Make a Website" -- is the root of the site. All your files and folders have to go inside that. If your index.html file is inside that folder, it should appear when your preview the workspace. If it doesn't there's a couple of possible problems:
- index.html is mispelled. If it is a capital "I" -- Index.html -- it won't work. Must be all lowercase.
- You accidentally moved the index.html file into another folder. That can happen pretty easily.
Hope that helps
Dave Lawlor
2,732 PointsThanks Dave - the capitalization may well have been the issue.
I'm also going to have to remember to use "z"'s instead of "s"'s in the syntax in order to move forward with this....common language and all that :-).
Thanks for your help....onwards and upwardz.
Dave McFarland
Treehouse TeacherAbsolutely! Onwardz
Dave Lawlor
2,732 PointsDave Lawlor
2,732 PointsHi Dave
Thanks for this, that explains it well.
There is one thing though, if you open the default "How to make a Website" workspace, the top level "How to make a Website" folder is provided.
I cannot create or move the index.html file outside this default folder - neither can I delete the provided, default folder.
I got round this issue by opening a new (non default) workspace, I called it MyFirstWebPage1 - the top level folder contained an index.html file. When I hit the preview button in this non default workspace the page displays as expected, no directory structure just Hello World.
I hope I've explained that clearly, again, thanks for your help Dave.