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

Tony Tomczeszyn
PLUS
Tony Tomczeszyn
Courses Plus Student 2,919 Points

I cannot get my links to work in ATOM. I am trying to link second page back to the first.

I am trying to link my second page, the article back to the home page. When watching the video, everything worked great in the workspace, but when I put it into atom, the links did not work.

6 Answers

It's hard to answer your question without seeing your code, but my best guess is what kind of link you have in your code. If it is a root relative link, your links will not work unless you are running your HTML through a web server (which workspaces does). If you have root relative links, and are just previewing the HTML directly in a browser, it will not work. Change your links to absolute URL's and it should work.

Tony Tomczeszyn
PLUS
Tony Tomczeszyn
Courses Plus Student 2,919 Points

I tried the code below and still cannot get it to link in Atom

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ultrices euismod turpis eget porta. Etiam nulla massa, pretium et massa nec, ornare dignissim nisi.</p> <a href="C:/Users/Dell/Desktop/project/articles/2017/article.html" target = "_blank">Read more</a> <footer>Publiched: June 12, 2017</footer> </article>

      <article>
        <header>
        <h3>The Advantages of VR simulation</h3>
          <p>By: Author McAuthorFace</p>
        </header>

        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ultrices euismod turpis eget porta. Etiam nulla massa, pretium et massa nec, ornare dignissim nisi.</p>
        <a href="/Users/Dell/Desktop/project/articles/2017/article.html" target = "_blank">Read more</a>
        <footer>Publiched: June 19, 2017</footer>

So your first link looks good. I would change the second link to the same format. Try opening your html document in a web browser directly. The text editor you use should not matter.

Tony Tomczeszyn
PLUS
Tony Tomczeszyn
Courses Plus Student 2,919 Points

Oh, by the way, I was using the same code that was taught here for the HTML, the VR Article one. Just in case that will help.

I understand that you are using the same code. I would re-watch the video where the links are added to the code, because the teacher explains the different formats for link url's.

In your example code, the first link uses a absolute url, which should work anywhere. The reason the second link will not work is because it is a root-relative url. Root-relative url's only work when you are running your html on a web-server. If you are opening your html directly in a browser, then root-relative url's will not work.

Tony Tomczeszyn
PLUS
Tony Tomczeszyn
Courses Plus Student 2,919 Points

Ok Jamison, that worked in my Chrome browser directly. Why cannot i get it to work in my Atom so that I can work on it throw the Preview???

Tony Tomczeszyn
PLUS
Tony Tomczeszyn
Courses Plus Student 2,919 Points

Okay, thank you Jamison. I will review that video. I missed something there. Thank you again.]

I would make it a habit of previewing your websites in Chrome. That way, you would know if the site works for others as well! Not everyone is going to be previewing in Atom, but most certainly would in Chrome or Firefox! Not to mention the excellent debugging tools that Chrome has to offer, although you get more into that with CSS and JavaScript.

Tony Tomczeszyn
PLUS
Tony Tomczeszyn
Courses Plus Student 2,919 Points

Thank you Jamison, everything worked. I also did what you said about making it a habit of previewing my site in Chrome. Works better that way. Thank you again for your help.