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
RE: Senna.js - disable adding of canonical url in Liferay DXP
We have a custom theme that sets and writes the <link rel="canonical" /> as we have quite complicated rules for this to help SEO.
I noticed that Senna.js writes its own version of the tag and we do not want to appear in the html head.
Is there any way of switching this specific behaviour off or will we have disable Senna.js completely?
Thanks
Have you found the way to disable adding of canonical url in Liferay DXP?
Thanks
Thanks
Not sure which version you use, but we hooked top_head.jsp and replaced the canonical behavior of 7.0. You probably need to do something similar. But it could depend on the Liferay version.
Hello,I'm using Liferay 7.2.
I think I should overwrite top_head.jsp using custom jsp bag using Custom JSP Bags but according to the documentation override JSPs is a bad practice. With Dynamic Includes or Portlet Filters I would not be able to eliminate <link data-senna-track="temporary" href="<%= HtmlUtil.escapeAttribute(canonicalURL) %>" rel="canonical" />
Do you think the only solution is Custom JSP Bags?
Thanks
I think I should overwrite top_head.jsp using custom jsp bag using Custom JSP Bags but according to the documentation override JSPs is a bad practice. With Dynamic Includes or Portlet Filters I would not be able to eliminate <link data-senna-track="temporary" href="<%= HtmlUtil.escapeAttribute(canonicalURL) %>" rel="canonical" />
Do you think the only solution is Custom JSP Bags?
Thanks
Ovidiu David Dan:
When changing a JSP, you'll always need to be aware of possible future changes to the underlying JSP as well. Prepare for 3-way-merges in case it does and you want to keep your installation current. That's why JSP manipulations are considered to be "brute force" and discouraged in general.
I think I should overwrite top_head.jsp using custom jsp bag using Custom JSP Bags but according to the documentation override JSPs is a bad practice.
That being said, a single-line change in a JSP isn't that big of a hazard for future maintenance and is justifiable. The problem begins once you start bringing in conditionals and heaploads of functionality. In that case, you are better off with a single line change introducing a custom Dynamic Include, then implement that DI. Rather than adding a gazillion of lines to the JSP, that is.
As long as you make JSP changes your last-resort rather than your first choice change - there's an argument for them. Especially when you modify them with your future self (maintaining this patch) in mind. Do your future self a favor and make maintenance as easy as possible...
Thank you. Overwriting the jsp I've got to remove the canonical tag generated by default
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™