Jump to content

HASH sign in URL's in Layered Navigation. What must me done?


cagrie

Recommended Posts

the hash sign (#) is ignored by the search engines during indexing and therefore our ajax filtered layered navigation links never end up in the SERPs.

 

but I found this guide in google where they explain how to use the hash tag SE friendly by appending a ! sign to it - #!

 

https://support.google.com/webmasters/answer/174992?hl=en

 

can it be done for layered navigation, do you think?

  • Like 1
Link to comment
Share on other sites

Hello Cragie,

 

Looks like this is an interesting subject. We also came accross this subject with Ajax Solar facet search.

 

You can proceed in two step :

  1. With prestashop you can easily appending the ! exclamation after the # hash, this will need some refactoring into prestashop/modules/blocklayered/blocklayered.js ) .
  2. Then, you will need to add a hook on every concerned controllers (usually Category controller only), in order to handle specific google bot requests asking for ?_escaped_fragment_=mystate (and then return the result of the ajaxCall() in appropriate product-list.tpl)
Edited by agenceweb74 (see edit history)
Link to comment
Share on other sites

  • 1 year later...

You don`t really need to remove it. Just point to google that you use AJAX 

 

Here is the guide: https://support.google.com/webmasters/answer/174992?hl=en 

And step-by-step for developers: https://developers.google.com/webmasters/ajax-crawling/docs/getting-started

 

All you need is to modify the php file of the module to serve the escaped_fragment_ get variable just like the selected_filters one.  Here is how I did it (blocklayered.php) : 

			if (Tools::getValue('selected_filters'))
				$url = Tools::getValue('selected_filters');
			else if (Tools::getValue('_escaped_fragment_'))
			$url = Tools::getValue('_escaped_fragment_');
			else
				$url = preg_replace('/(?<=#!).*/', '$1', Tools::safeOutput($_SERVER['REQUEST_URI'], true));

and change the url of the filter links from # to #! at the php and js file (it done on many places in the file, so just search for '#' or '#/' 

Good luck!

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...