问题原文
原帖链接 · irgfx · CC BY-SA 4.0
I searched in many articles but nobody has talked about this stuff. For example, google suggested JSON-LD for structured data but I wanna know if I add dozens line of JSON codes, does not it affect on my page speed badly?
I mean tools like GTMetrix pay attention to inline JS codes and say:
it is better to minify and load inline codes from a file instead of using them inline.
已采纳解答
原帖链接 · Henry Visotski · CC BY-SA 4.0
Besides being Google's preferred structured data markup format for a reason, JSON-LD is described as "a lightweight Linked Data format" on its documentation site.
Also, according to this blog post, "Unlike JavaScript there is no render delay with a data linking format. This means you can place the code anywhere you like without having to worry about slow loading times. The code will increase your HTML content size, but only by a tiny bit – completely negligible when it comes to page load times."
And according to this post, "It does not affect the performance of the page because it can be loaded asynchronously." Basically, you can insert it almost anywhere on the page - head and footer are both fair game.
Think of it this way. JSON-LD structured data format describes the content on a page. It is not a script that does a lot of heavy lifting or transforms anything on a page. It is therefore very lightweight, and unless there is another underlying issue, it won't slow down your website.
As for minification of code, yes, that is recommended regardless.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
