I would like to ask, how you link to the current page? I saw href="#"
method, I saw someone using href="./"
and at another site, an item which represents current page does not have href
. Which method will be the best for SEO?
-
2Links to the current page are not really an SEO concern. You can have them, or not. They don't change how your page is crawled, indexed, or ranked.– Stephen Ostermiller ♦Commented Aug 30, 2018 at 10:49
-
@StephenOstermiller this is what I was looking for :) thanks!– AK994Commented Aug 30, 2018 at 13:14
2 Answers
It depends on what you are expecting. If you want to scroll to a specific part of the page you need to use # as anchor text. This method is fast cause you don't refresh the site, just move inside it.
If you just want to refresh the page, just link to the absolute URL (example.com) or the relative one (/).
-
I mean situation, for ex. When I'm at /some-page.php then I should at navbar use reference to this page by using # or /, make this link disabled, use full url adress for current page, or just reference to "some-page.php" ?– AK994Commented Aug 30, 2018 at 7:47
-
In your menu you wouldn't change the URL. Either you would leave the link in the menu item as
/some-page.php
just like it is on other pages, you would remove it entirely, you would disable it, or you would highlight it. It doesn't matter for SEO which you do. Users like to have the current page highlighted in the menu so that they know where they are. Commented Aug 30, 2018 at 10:52 -
@StephenOstermiller thanks alot ! I was think it's doesnt making any change but better to ask specialists ;)– AK994Commented Aug 30, 2018 at 13:13
As has already been mentioned in comments, linking back to the current page has nothing to do with SEO.
The only reason you might want to do this is as a benefit for your users. To link back to the canonical URL (which might be different to the URL the user is currently on). eg. Stack Exchange does this by linking the question title to the canonical URL. This is just to help users easily grab the canonical URL. The canonical URL is already included in the <link rel="canonical"
element for the benefit of bots.
I saw
href="#"
This results in the page scrolling back to the top. The page is not reloaded.
I saw someone using
href="./"
This doesn't necessarily link back to the current page. It links back to the current "directory". eg. If you were at the URL /foo/bar
, then href="./"
would link to /foo/
, not /foo/bar
.
an item which represents current page does not have
href
Well, that's not strictly valid, unless they are using JavaScript to construct the anchor. However, you should always have an href
attribute.
To link back to the current page then you should use the full absolute URL (with scheme + hostname) or root-relative URL (starting with a slash) - just as if you were linking to any other URL.