1

I have read in some sites that is a good practice for SEO to use URLs like www.example.com/params-for-your-search as words separated by hyphens.

I'm creating a SPA ReactJS Application where I have a list of elements that can be filtered or searched by tags. So, when the user selects a tag, the application does an AJAX request and get the filtered elements.

But as I'm using AJAX (Axios library), the URL does not change, it is always something like www.example.com, no matter what filter you are applying.

What is the best coding SEO practice when you are programming "internal" searches?

It is better to change my URL, setting the selected tags separated by hyphens? What would be the best way to do it in react?

  • When you say "internal searches" are you showing search results on your site? If so, it is good that Google can't crawl them. Google will penalize a site that allows its search to be crawled. See what Google's Matt Cutts has to say about the reasons: Search results in search results. – Stephen Ostermiller Aug 27 '18 at 23:39
  • I don't have any experience with Axios, but it is possible to change the URL using JavaScript without reloading the page. You can look into pushState. Matt Cutts says that pushState can work great with Google: seroundtable.com/google-ajax-pushstate-vs-hashbang-16464.html – Stephen Ostermiller Aug 27 '18 at 23:40
  • With "Internal searches" I mean searches in my database. I have a group of elements to be listed, and users can filter the results of them. For example, if they want to see only elements tagged as "Canada", they can do it. I suppose that the correct way would be change the url to something like www.example.com/elements-from-canada. – Darío GL Aug 28 '18 at 4:33
  • Another example: If you want to search men watches on google, one of the results would be ebay.com/bhp/mens-watches, so they're expressing the key words in the url (men-watches) – Darío GL Aug 28 '18 at 4:36
  • Google doesn't want to index pages like the Ebay example because it looks like search results. Google considers it bad user experience for users to click from the Google search results to land on another page with such a similar layout. – Stephen Ostermiller Aug 28 '18 at 10:32
1

Google will only ever reward for content that appears on page load. It's not a user, it won't fill in forms, it won't click checkboxes and so on, therefore, you need to make the search results accessible by a URL.

Google used to use AJAX _escaped_fragment_ but now it uses #!.

Examples:

  • www.example.com/#!/search-term/
  • www.example.com/#!search-term.

Then you need to ensure that Google can see these URLS, this can be done in the sitemap but ideally, include them in easy to read JavaScript. Then you test those URLS using the Google Fetch and Render, ensuring that Google can see the extra content.

  • 1
    Why use #! opposed to just # now that Google has stopped the _escaped_fragment_ crawling? The only benefit of the exclamation mark was that it would trigger special crawling. Now Google treats #! URLs the same as normal # URLs. I don't see any benefit to including the ! and I wouldn't suggest that anybody start doing so at this point. – Stephen Ostermiller Aug 27 '18 at 23:37
  • The benefit is that browsers will not scroll down, for example, if you have an <div id="cars"> and then you use #cars it'll jump down the page while using #!/cars or #!cars would not. – Simon Hayter Aug 29 '18 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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