What is the function of the html "rel" attribute? [closed]
Asked Answered
B

4

11

I understand that rel got something to do with relationships between things (documents? elements?) but I don't really get anything past that. What exactly does it do when used in the achor tag ? Also, are there specific values for x in rel="x"?

Berkey answered 22/8, 2013 at 0:42 Comment(1)
This question effectively asks for a tutorial. Good answers would be too long for the format of SO answers. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. Basically, rel attributes “do” the same as any HTML attribute, namely nothing. They are data, they may have defined meanings, and they may be processed by software (search engines, browsers, etc.). The meanings can be found in HTML specifications.Fluvial
R
10

Typically they are used to provide information to search engines about the structure of your website. For instance, you can give links a next or prev rel attribute for paginating links (links which show the next/last set of search results); A nofollow to inform search engines not to crawl (this is also good for not passing SEO 'link juice' to external or low priority pages); Or you could supply a canonical value to tell search engines which is the default link for the page it is looking at (sometimes pages are accessible via a number of different links, and this avoids indexing of duplicate content which could hurt your SEO).

This describes only a few possible uses - it is a very versatile tag.

With regards to navigation, pagination and canonicalization, here are couple of useful links from Google:

https://web.archive.org/web/20180125083221/https://support.google.com/webmasters/answer/1663744

https://support.google.com/webmasters/answer/139394

Romans answered 22/8, 2013 at 0:50 Comment(2)
Thanks, I think I found your answer most helpful, so I guess I'll give you the marked answer (not to say the others weren't, but this gave me extra info)Berkey
This is a rather narrow description: it discusses only one aspect of the use of rel attributes.Fluvial
K
0

it specifies the relationship between the current document and the linked document.

here you can find a good reference: http://reference.sitepoint.com/html/a/rel

and this was helpfull to me too

http://www.falsepositives.com/index.php/2009/03/24/html-tags-and-rel-attributes-you-really-should-know/

Regards

Kujawa answered 22/8, 2013 at 0:47 Comment(0)
C
0

the rel attribute links files such as CSS(cascading Stylesheets) JS(Javascript), and other indexed files to its sources.

For example if I wanted to link a stylesheet to my index.html

I would type

 <link rel="stylesheet" href="style.css" type="text/css" media="all" />
Coze answered 22/8, 2013 at 0:51 Comment(0)
O
0

Let's see some examples of possible values of rel, which indicates the relationship between the href page(linked document) and the actual page:

<a href="http://creativecommons.org/licenses/by/2.0/" rel="license">cc by 2.0</a>

Here the page indicates that the destination of that hyperlink is a license for the current page

<a rel="directory" href="http://dmoz.org/Computers/Internet/">Computers/Internet</a>

In this one the page indicates that the destination of the hyperlink is a directory listing containing an entry for the current page.

Check more at http://microformats.org/wiki/rel-faq#How_is_rel_used

Or answered 22/8, 2013 at 1:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.