问题原文
原帖链接 · sam · CC BY-SA 3.0
I've been reviewing the speed of a site using Google PageSpeed, and one of the things it told me to do was minify the HTML of the page.
I'm fine with this, but by minifying the HTML (or any other markup or language) it begins to obfuscate it.
Could minifying the HTML of a page, although making the page faster, have a negative effect on how the search bot can read my page, and thus how well the site will rank?
社区高分解答
原帖链接 · Tim Malone · CC BY-SA 3.0
This is a good question, but the answer is no - it will not affect your search engine rankings negatively. It will provide a (marginal) benefit due to decreased file size.
To understand why it won't negatively affect you, open your site up, right click anywhere, and select "Inspect element" (this option will be called something slightly different between different browsers, and is distinct from "View source" in that it shows you the source of your page after processing by the browser).
Now turn your HTML minification on, and do the same thing. Does it look any different? While you'll notice the classic View source option shows code that is a bit more unreadable to you, viewing the processed source will be no different.
The point here is that once the browser has parsed the HTML, whether it's minified or not, it's all the same. A search engine bot will also work the same way. Line breaks and indentation in an HTML document are simply for human readability - your original code needs to be readable by humans, but the resulting code once it's processed can be compressed as much as you like - the browser, the bots, any other machine cares only for code, not presentation.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
