11

For SEO purposes, should <a> tags with href="#" make use of rel="nofollow", rel="noindex", rel="noindex, nofollow", or does it not matter?

I'm asking because I have some elements on my site where I use anchor tags to trigger mouseovers, etc, and I'm just wondering how the search engines handle those links.

14
  • 5
    Never have #'d anchor tags, it's bad practice, bad for SEO and bad for accessibility. Commented Feb 21, 2012 at 20:01
  • 2
    It's not bad for SEO. It's perfectly fine to use #'s when anchoring to parts of the page or a remote page it's an w3 standard, w3schools.com/tags/att_a_href.asp You can use jquery and set a class or ID of the <a> to trigger the mouseover events if you want
    – Anagio
    Commented Feb 21, 2012 at 21:59
  • @toomanyairmiles why would it be bad for seo or accessibility?
    – user6901
    Commented Feb 21, 2012 at 23:15
  • 2
    @Christofian firstly javascript should be unobtrusive, secondly if there is no href it should be a button tag or something else semantically correct it's bad for SEO because google can't or won't follow it - it's simply ignored and whatever content is behind it won't be indexed. Commented Feb 22, 2012 at 0:02
  • 2
    @Anagio w3schools is not affiliated with the w3c and is full of errors. It is bad for SEO because it will be ignored and it's semantically meaningless. Commented Feb 22, 2012 at 0:03

5 Answers 5

9

Don't nofollow internal links.
Pointing to a flat # as destination arguably doesn't actually "link" anywhere, but there's still no reason to do it.

9

You shouldn't have links with # or javascript:void(0) in the first place. You should point the link to an appropriate resource - for example if you are making an image viewer, the link should go to the image itself. If you are making a popup window, the link should point to the URL from the popup window, in case the user has Javascript disabled.

If there is no appropriate resource at all, then you shouldn't be using a link in the first place. Use a span or div element and attach the Javascript event to that. Note you can style it to look like a link with cursor: pointer;

And as Su recommends, never use nofollow on internal links. There used to be a process called "PageRank sculpting" (which was ridiculous and barely effective anyway) but that is no longer effective at all.

1
  • I would like to point that you may want to use a link instead of div because it allows focusing through the keyboard. The same can be achieved with buttons but buttons are horrible CSS wise. For all webmaster: please stop using div with onclick, some of us like to be able to use the keyboard to navigate a website.
    – Mijamo
    Commented Jun 15, 2017 at 8:39
3

Personally I'd always prefer to not include any links that have an href="#", but I guess it depends on context.

If you're doing something clever with javascript with the link in question, which would be one of the only reasons I would expect to find an href="#" or href="javascript:void(0);", then why not, instead of allowing the link to ever appear in spiderable (not sure if that's actually a word) markup, why not simply append it into the page whenever your javascript executes, attaching event handlers and other functionality as needed.

Although using id/anchors as navigation within a page is perfectly valid, I can't quite see a reason to provide an empty one, although without an example this is all pretty subjective/conjecture.

APOLOGIES

I don't think I actually answered the question there....

I guess it may well be treated by google as a link back to the current page, but I'm not entirely sure how that would hinder, or help SEO at all.

Realistically, there's not a situation I can think of where it would be a good idea to provide a totally dead link though.

Answer. Doesn't matter, but still, don't do it anyway....!

Good luck!

2

Unless you have Title Tags within the Link, the # sign won't do anything. It is not a link, because there is virtually no value. You could always use name="".

0

People who are not sighted use tabs, not cursors and will be tabbing from one anchor tag to another when traversing the page.

Thus, if you are writing pages that are going to be read by folks who are using text-to-speech browsers (such as Jaws) using # tags internal to the page is a very helpful way to structure navigation.

Jaws will announce these tags as the person reaches them. So you can create a directory of important internal links using the # tags.

You should also use the H1, H2, etc. tags meaningfully because these are also used to create a non-visual index of the content for the person browsing the page.

1
  • 1
    Completely unrelated to the actual question.
    – Su'
    Commented Jun 3, 2012 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.