Externalizing Inline script data to reduce HTML file size for improved SEO indexing #12491
RykGitProjects
started this conversation in
Ideas
Replies: 1 comment 7 replies
-
Could you share the URL of the site you're talking about? If the SvelteKit startup script is taking 110 kB it would seem that you have a very large number of scripts that it is loading. Perhaps you could use a custom Vite chunking to reduce the number of output scripts that need to be loaded by the inline script: https://v3.vitejs.dev/guide/build.html#chunking-strategy |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I am an enthusiastic user of SvelteKit for web development, appreciating its speed and ease of use. To optimize performance, I've implemented various strategies such as loading libraries only after user scrolls and loading Google Tag Manager on user interaction. These enhancements cater to both user experience and search engine requirements since bots typically do not simulate interactions.
Issue:
<script> { __sveltekit_erhfef = { base: new URL("../..", location).pathname slice(0, -1) }; const element = document.currentScript.parentElement; const data = []; Promise.all([ import("../../_app/immutable/entry/start.B791bc_E.js"), import("../../_app/immutable/entry/app.CIH1Uats.js") ]).then(([kit, app]) => { kit.start(app, element, { node_ids: [0, 10], data, form: null, error: null }); }); } </script>However, a significant challenge I face relates to SEO with Bing Search, which has indicated that many pages exceed the 125 kB size limit for the HTML documents. This is primarily due to the large inline scripts that SvelteKit appends for hydration and SSR, embedded directly within the main HTML:
In my specific case, the inclusion of this script increases the source code of a page from about 80 kB without the script to approximately 190 kB with it. This nearly triples the file size, significantly impacting indexing as Bing does not prefer to store large HTML files.
Suggestion:
Would it be feasible to introduce a feature in SvelteKit that allows for the externalization of this script data, akin to linking CSS files externally? This modification would considerably reduce the size of the initial HTML document, which is crucial for meeting Bing's indexing requirements.
While further data optimization is possible, such as compressing or restructuring the data, the fundamental issue of large HTML document size remains. An option to externalize the script data would directly address this challenge.
Thank you for considering this feature request. Any feedback or suggestions from the community would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions