Issue
- Why is the Javascript percentage high as compared to the HTML percentage in Liferay, which should be vice versa in any application if someone wants their sites to be crawled by Google?
- As per the GSC (Google Search Console) testing, how Liferay is using JavaScript and HTML is causing this.
Environment
- Liferay DXP [All updates/versions]
Resolution
-
The “By File Type” report informs that the site is mainly generated by Javascript, as there are many more JS resources than HTML ones. This is the normal pattern in Liferay DXP, as DXP doesn’t do server-side rendering, and by the fact that sites are SPA-enabled by default.
-
When SPA (Single Page Application) is enabled, only the first navigation to the site is indexed as HTML, and then when the user starts navigating within the site, HTTP requests start happening to API, JS, and CSS but not HTML anymore.
-
So the architecture of Liferay is making that report like that, with more JS and JSON than HTML.
-
If the loaded JS, JSON, and CSS are well crafted, loading what is needed and no more, the performance should not be affected for this.
Additional Information
- Liferay has this epic Enhance Liferay DXP Configuration Options for Optimal Website PerformanceOpen to start Discovery in 2025 (might be in Q1), where the aim is to improve performance. The goal is to improve the Page Speed report from Google, while the report about File Type in the crawler could remain the same because, as highlighted above, that report doesn’t mean implicitly that performance is bad, "it just a little bit how the website is built".