Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Hide parameters on Asset Publisher for SEO reason
Hello everyone,
My client wants to hide the parameters in the url when the user select a category.
Liferay uses Public Renderer Parameters to store the choice.
Anyone knows how can we do that ?We want to do that for all users (connected or not) => we can not use the user session !
We can use the localStorage but the server side not see it and if the same user have 2 tabs in the same browser we will have problem... it is the same for cookie.
We think to use Liferay Event (Liferay.on and Liferay.fire) but it works on a unique page, we can not pass argument to the next page (if we have navigation to a full content on a display page)
For the moment, we are thinking to call the full page with the desired argument in AJAX and after update a part of our page.
It works but it is not the best because we ask for all the page and we want only the content of one portlet.
If anyone have a good idea... or knows how to make an url for particular portlet (so we can update only this portlet in AJAX) ?
Thanks for your advice or help,
Eric.
My client wants to hide the parameters in the url when the user select a category.
Liferay uses Public Renderer Parameters to store the choice.
Anyone knows how can we do that ?We want to do that for all users (connected or not) => we can not use the user session !
We can use the localStorage but the server side not see it and if the same user have 2 tabs in the same browser we will have problem... it is the same for cookie.
We think to use Liferay Event (Liferay.on and Liferay.fire) but it works on a unique page, we can not pass argument to the next page (if we have navigation to a full content on a display page)
For the moment, we are thinking to call the full page with the desired argument in AJAX and after update a part of our page.
It works but it is not the best because we ask for all the page and we want only the content of one portlet.
If anyone have a good idea... or knows how to make an url for particular portlet (so we can update only this portlet in AJAX) ?
Thanks for your advice or help,
Eric.
First, a different idea:
You can configure how e.g. google handles get parameters. So, maybe there is another solution for your SEO problem (whatever it might be!)
https://www.seerinteractive.com/labs/the-seo-starter-guide-to-google-search-console/using-url-parameters-in-webmaster-tools/
Maybe you can also explain what the SEO issue here should be. Getting rid of that parameter looks like a lot of work and I honestly don't see the benefit.
Anyway. When you go to portlet configuration, you can find there a "Sharing" tab. It contains a url that sends you that one portlet. Maybe that Iframe is even enough to solve your issue, but if you really need, you could fetch the asset publisher content with ajax too.
Please note that you will of course also have to change the portlets (e.g. Category Navigation) that create the url.
You can configure how e.g. google handles get parameters. So, maybe there is another solution for your SEO problem (whatever it might be!)
https://www.seerinteractive.com/labs/the-seo-starter-guide-to-google-search-console/using-url-parameters-in-webmaster-tools/
Maybe you can also explain what the SEO issue here should be. Getting rid of that parameter looks like a lot of work and I honestly don't see the benefit.
Anyway. When you go to portlet configuration, you can find there a "Sharing" tab. It contains a url that sends you that one portlet. Maybe that Iframe is even enough to solve your issue, but if you really need, you could fetch the asset publisher content with ajax too.
Please note that you will of course also have to change the portlets (e.g. Category Navigation) that create the url.
Thank you Christoph for your 2 advices.
For my client, I think it is a SEO problem AND he finds the url ugly with parameters. I will share your first advice to him.For the second advice, it is exactly what we want, with the "Sharing" tab, we can get only our portlet and not all the page. :-)
I think we will update the "Category Navigation" and make a AJAX call to the desired portlet (and not a url link).After that we will replace the content of the portlet of our page (in jquery for example) with the content of the result of the AJAX call. It is not a lot of work only few hours I think.
For my client, I think it is a SEO problem AND he finds the url ugly with parameters. I will share your first advice to him.For the second advice, it is exactly what we want, with the "Sharing" tab, we can get only our portlet and not all the page. :-)
I think we will update the "Category Navigation" and make a AJAX call to the desired portlet (and not a url link).After that we will replace the content of the portlet of our page (in jquery for example) with the content of the result of the AJAX call. It is not a lot of work only few hours I think.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™