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

Brittany Reid
Brittany Reid
529 Points

article.html opening as Homepage

When I try to open my article.html file in the Preview it's showing my index.html page instead. Please help.

James Head
James Head
18,872 Points

Hi Brittany. Can you post your code or a link to the video you're stuck on?

Brittany Reid
Brittany Reid
529 Points

<!DOCTYPE html> <html> <head> <title>VR Article</title> </head>

<body> <div> <header> <h1>Experience VR</h1> <p>A simple blog aboout virtual reality experiences</p>

    <nav>
      <ul>
        <li><a href="index.html">Home</a></li> 
        <li><a href="#">About</a></li>
        <li><a href="#">Articles</a></li>
        <li><a href="#">Contact</a></li>

      </ul>
    </nav>
  </header>

 <article>
   <header>
    <h2>VR Article</h2>
    <p>By: John McJames</p>
    <p>Published June 19, 2017</p>
   </header>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce finibus urna lacus, ut lacinia elit pretium a. Praesent rutrum ac ipsum vitae rhoncus. Nam non molestie purus.</p>
    <aside>
      <q>This is a pull quote from the VR article...</q>
   </aside>
    <p>Nunc imperdiet, dui in varius eleifend, magna enim imperdiet felis, at ultricies magna metus vitae ante. Nulla in porttitor nibh. Mauris non libero in massa porta varius non sed magna. Donec ac mauris mattis, viverra turpis ac, dictum arcu.</p>
    <p>Vivamus molestie laoreet viverra. Ut ac fringilla ex. Donec at nisl semper, commodo mi maximus, fermentum nisi. Duis bibendum gravida ante sit amet consectetur. Curabitur ac est id justo euismod porta quis ac arcu.</p>
 </article>

  <aside>
    <h3>More Articles About VR</h3>
    <ul>
      <li><a href="#">Make a VR Game</a></li>
      <li><a href="#">Learn VR In Unity</a></li>
      <li><a href="#">Learn VR Interface</a></li>
    </ul>
  </aside>

  <footer>
  <p>&copy;2017 Experience VR, The Blog</p>

    <section>
      <h2>Contact</h2>
      <p>Email us at coolvrexperience@gmail.com</p>
    </section>

  </footer>

</div>
</body> </html>

6 Answers

James Head
James Head
18,872 Points

Hi Brittany, I have just had a look at workspaces. It is normal that the preview always goes to the index page (your homepage). Just as it would when viewing a normal website in the browser.

What you need to do is link to your articles page in your nav html like below:

<li><a href="articles.html">Articles</a></li>

Instead of

<li><a href="#">Articles</a></li> 

Then when you click on preview it will take you to the index page and from the menu you can select your articles page.

I hope that makes sense.

But you need the have <li><a href="articles.html">Articles</a></li> instead of <li><a href="#">Articles</a></li>

Brittany Reid
Brittany Reid
529 Points

You guys are the best. Thank you so much! I just started this 2 weeks so I am a total noob, but I got it figured out with your help! I didn't realize that the preview would only generate the index.html and that I would need to link myself over to the article.html through my own hyperlink in the index.html page. Thanks again!

Brittany Reid No problem :D Can you upvote my comment please?

you need to add in the browser /article.html

James Head
James Head
18,872 Points

Hi Brittney, I'm not familiar with this particular video but looking at your navigation HTML your articles link has a #. You will need to put the name of the file you're trying to link to. For example:

<li><a href="articles.html">Articles</a></li>

Instead of

<li><a href="#">Articles</a></li>

Brittany Reid
Brittany Reid
529 Points

I'm can't access any of the links within this page because I can't see any of the content on this page because this page won't open in Preview. This page (article.html) is displaying as the content of my index.html.

thats probably because you dont hav any file called article.html

Brittany Reid
Brittany Reid
529 Points

I do. I have both an index.html and an article.html file.

James Head
James Head
18,872 Points

Glad you got it sorted Brittany :)