For complicated reasons, we can't use <a href="">
tags on part of one of our pages.
If we use <button role="link">
, will Search Engines crawl the page? If not, is there another way to tell google to crawl <button>
s?
For complicated reasons, we can't use <a href="">
tags on part of one of our pages.
If we use <button role="link">
, will Search Engines crawl the page? If not, is there another way to tell google to crawl <button>
s?
Googlebot does scan JavaScript files for things that look like links. For example if you use the Javascript var s="/foo/bar.html"
Google will likely try to crawl /foo/bar.html
to see if it can find a page there. In my experience Googlebot will try to crawl any reasonable length string literal than contains a slash but no spaces. Googlebot is likely to miss URLs that don't look enough like URLs or ones which are built from other smaller strings.
I've never tried to rely on this Googlebot heuristic to get my sites crawled and indexed. I wouldn't recommend that you do either. It isn't clear that Googlebot passes any link juice to URLs discovered in JavaScript files. So even if Googlebot finds your pages this way, it isn't likely to index them, and certainly not likely to rank them well.
Single page sites are very hard for Googlebot to grok. Even though Googlebot can execute JavaScript, Googlebot doesn't simulate scrolling or clicking on anything. To get an AJAX powered site crawled, you really need to use normal <a href=
links in your pages for Googlebot. You can intercept clicks on links with Javascript and return false
or event.preventDefault
to change the content without having the browser load a whole new page.
If you really can't use <a>
tags, I'd recommend putting the URLs into data
attributes on the buttons. Google should be able to crawl those as well. See Does Googlebot crawl items that look like URLs in HTML5 data-* attributes? I don't know if those would pass link juice either, but I'd find it more plausible that they would do so.
Generally no, it's not indexable by Google. However, it's possible if you process/convert that button into a link using JavaScript.
On possible solution would be to use forms instead of buttons. The official Google blog says Googlebot follows GET-based forms. So if you want your button crawled, surround it using a form tag using a GET
action. Then the URL will be indexed.
Unfortunately, no. If you need to change a tag name, it's better to replace it with <a>
, instead of <form>
.
Here is an example of main tag replace with js: replace specific tag name javascript