Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Understanding link relationships

From: HTML5: Structure, Syntax, and Semantics

Video: Understanding link relationships

So far, we've discussed how HTML5 allows us to describe the contents of our documents in a more semantic way. In this movie, I want to explore how HTML5 expands your ability to add more meaning to how your pages relate to their resources and links, essentially giving you the ability to define the relationship between your current page and the external resources and pages that it links to. We will accomplish this by using the rel attribute. Now, the rel attribute isn't anything new. It's been around for quite some time, and I'm sure that in the past you've used it with the link tag, and possibly even the anchor element.

Understanding link relationships

So far, we've discussed how HTML5 allows us to describe the contents of our documents in a more semantic way. In this movie, I want to explore how HTML5 expands your ability to add more meaning to how your pages relate to their resources and links, essentially giving you the ability to define the relationship between your current page and the external resources and pages that it links to. We will accomplish this by using the rel attribute. Now, the rel attribute isn't anything new. It's been around for quite some time, and I'm sure that in the past you've used it with the link tag, and possibly even the anchor element.

But in HTML5, the area tag has also been added to the elements that can use the rel attribute. So, what does it do? Well, if we go to the specification, and here I am looking at the author view of the HTML5 specification, and I am navigated to the link element section 4.2.4. If I scroll down just a little bit, I will get right into the section that discusses the rel attribute. Now, one of the things I want to point out before we get too deep into the rel attribute and what its allowed values are, is this little sentence right up here, "A link element must have a rel attribute." Now, contrast that with the anchor tag and the area element; both of those elements are optional in terms of using the rel attribute, so you have to use it on a link tag. On an anchor tag or an area tag, it's an optional value.

Okay, so what does the rel attribute, or relationship attribute, really actually do? Well, it basically defines the link; what type of link is it? And it's going to define it as either a link to an external resource or as a hyperlink. Now, of course there is a little bit more to it than this. Basically, it's helping user agents and applications find and use certain link types, as well as locating external resources that are necessary to the current page, like CSS files or external JavaScript documents.

Also, one of the really nice benefits of using it is it helps you describe the nature of links throughout a site. It's sort of describing how those pages relate to each other, and that's extremely helpful for search engines. So, there is a lot of value in using the rel attribute. Now, you are also limited, when you use it, to certain keywords. And if you notice right up here, the specification gives us a link to those allowed keywords and their meaning. So, in order to dig a little deeper into the rel attribute, let's go take a look at those.

So, here I am at section 4.12.3, Link types. Essentially, if I scroll down a little bit, we get this really nice table down here. What we have in the first column are the actual keyword values themselves. Then we have whether they can be applied to link or anchor and area. Notice that essentially, sometimes certain values are not allowed. So, for example, you couldn't use the bookmark keyword on a link element. And then there is a very brief description. Now, if you click on the name of the attribute keyword value itself, it will take you to a little bit of a longer description.

Before we check out any of those, let's take a look at some of these. And I want to focus on the ones that are new to HTML5. We have a dramatically expanded list of allowed keywords in HTML5 versus HTML 4. It's a lot larger, and a lot of those changes are reflecting the changing nature of web and how people and how links type and the way people have been using sites have changed a little bit. So, let's take a look, a very brief look at some of the new ones. We have author, which essentially says that this link is taking us to a document that describes or provides the contact information for the author of the document itself.

We have external, which is telling people that this link is going to a page outside, or an external site from the page that we are currently on. We have icon, which indicates that the resource is an icon that represents the site or the page, so this is used a lot for the fav icons that people use for their web sites. We have license. That indicates that the information in the current page is covered under the license that's described in the link document, so that's really helpful if you have links going out to legal documents or usage terms, things of that nature.

Now, I am going to scroll down just a little bit more. And this next section of links I want to talk about really showcases how some of these attribute values have been added, in terms of how web sites have been evolving. Now, the first one, for example, is nofollow. If any of you guys out there have been doing a lot of blogging, this probably is very familiar to you. It's essentially instructing a search engine not to follow the link. You are not endorsing that particular link or that side. You don't want it to affect your rankings based on where the site might go; maybe it's the site you don't trust, maybe you are really not sure where it's going, that sort of thing.

We have noreferrer, which instructs the user agent not to send an HTTP referrer along with the link. pingback, which is going to give the address of the server that handles pingbacks with the document. Again, this is really widely used in blogs. And we have a very interesting one here, prefetch. A prefetch informs the user agent to basically cache up the resources when the page loads before the link has been clicked. This is not very widely supported right now, and it remains to be seen whether this is going to be supported in any significant manner within user agents.

We have the search, which indicates that the linked resource allows users to search through the document and pages that might be related to that. And we have another one that is highly reflective of blogging, which is tag. That indicates that the given URL is also a user-designated tag for the current page. So, you can use this, for example, for tagging specific pages, or portions of pages. Now, it's really interesting to note here that the URL of the resource is actually the tag, not title that you might give the particular link.

So, if you were linking, for example, to page, that's also a category in your blog--maybe, for example, you're doing a movie review blog and you might have a reviews.html page. So, essentially the reviews would be the tag. Essentially, you are telling user agents that hey, this is also a tag within my blog, or within my site. Okay, now I mentioned before that if you click on one of these links-- so, for example, let me click on tag-- that will take you down to a little bit broader description. A lot of times you will have notes usage in here and some extra material, so be sure to go ahead and read those for a more thorough description of them.

Now, if you're not careful, it's easy to just look at his particular table and miss a lot of the other acceptable keywords for the rel attribute. So, I'm going to just go from where I am at right now, which is looking at the larger description of tag, and just scroll down a little bit. And if I scroll down another couple of sections to this 4.12.3.17 Other link types, I also see within the specification that it says that extensions to the predefined set of link types may be registered in the Microformats wiki existing-rel-values page.

Now what does that actually mean? Well, what it means is that any values described in the Microformats page is also acceptable to the HTML5 specification. Now, this is a constantly changing resource, and people are adding new ones all the time. So in order to keep up and keep track of all these attribute values, I want to give you a couple of resources. Now, the first is the Microformats page itself, and you can find this at microformats.org. And just scrolling through this page shows you that there are a ton of values that we did not see in the HTML5 specification.

Now, just to give you an idea of what's going on here, you are going to find the value itself, a brief description of that, and then the specification from where that comes. Now, this page can be a little confusing. There are a lot of tables on here and if you read through them, you'll find out what's going on. Some of these are just brainstorming ideas, some of them are listing values that have been prior specifications and now appear to be dropped, and then some are proposed. So, there is a lot happening. There is another page that you can go to that has probably a neater and more concise list, and that is a Webtap magazine.

If you go to Webtap magazine and browse through their archives, go into September of 2010 and you'll find a link to the page, Your Ultimate Guide to the Rel Attribute in HTML5. Now, if I scroll down here, I can see there is a much more concise table. This gives me not only the value but the specification which it was found in, in terms of was it found in HTML5 as well as HTML 4, and then you can scroll down and you can find ones that are only on the HTML5 specification, and kind of what's going on with that.

And then it also lists some that are existing in other specifications as well. So, it's a nice color-coded list of all the acceptable values, which elements they are allowed on, and what spec they belong to. Now, again this is a constantly changing list. This article is from September of 2010. So really, to keep up to date with this, make sure that you continue to reference back to the HTML5 specification as well as the Microformats page, so you can get a nice idea as to what is currently acceptable and which ones have been added.

All right, so now that we have explored some of our options for defining link relationships, we are going to go back to our trails page and finish it up by adding rel attributes to some of our links, and we are going to tackle that next.

Show transcript

This video is part of

Image for HTML5: Structure, Syntax, and Semantics
HTML5: Structure, Syntax, and Semantics

46 video lessons · 35880 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 2m 20s
    1. Welcome
      48s
    2. Using the exercise files
      1m 32s
  2. 18m 41s
    1. A brief overview of HTML5
      3m 57s
    2. What's in the HTML5 specification?
      8m 17s
    3. Why do we need new structural elements?
      6m 27s
  3. 50m 33s
    1. Defining HTML5 documents
      5m 5s
    2. HTML5 syntax
      9m 14s
    3. The header element
      5m 22s
    4. The nav element
      4m 55s
    5. The section element
      4m 51s
    6. The article element
      4m 48s
    7. The aside element
      4m 13s
    8. The footer element
      4m 17s
    9. Content model overview
      7m 48s
  4. 35m 28s
    1. Understanding the outline algorithm
      3m 17s
    2. Creating document sections
      8m 25s
    3. Using headings properly
      9m 1s
    4. Using hgroup to override sectioning
      4m 17s
    5. Properly nesting structure
      7m 17s
    6. Sectioning roots
      3m 11s
  5. 58m 30s
    1. Organizing content
      4m 41s
    2. Planning document structure
      5m 47s
    3. Choosing the right structural element
      4m 43s
    4. Checking document outlines
      5m 27s
    5. Coding initial page structure
      5m 28s
    6. Using class and ID attributes
      5m 31s
    7. Structuring headers
      13m 13s
    8. Building navigation
      7m 1s
    9. Structuring footers
      6m 39s
  6. 1h 27m
    1. Working with figure and figcaption
      7m 12s
    2. Grouping content with asides
      3m 46s
    3. Using divs in HTML5
      5m 0s
    4. Working with lists in HTML5
      7m 10s
    5. The return of bold and italic
      5m 52s
    6. Citing works semantically
      6m 32s
    7. Using the address element
      5m 24s
    8. Using the small element
      4m 24s
    9. Using the mark element
      5m 16s
    10. Working with date and time
      11m 55s
    11. Creating block-level links
      8m 53s
    12. Understanding link relationships
      9m 28s
    13. Defining link relationships
      6m 23s
  7. 17m 22s
    1. Current browser support
      7m 38s
    2. Ensuring block-level display
      4m 3s
    3. Adding support for elements in older browsers
      5m 41s
  8. 3m 46s
    1. Additional Resources
      3m 46s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed HTML5: Structure, Syntax, and Semantics.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.