I’ve become a little stuck after I changed some of my code. Can’t figure out what I have changed because the coma’s and double quotes are causing some errors in the for loop.
Regarding the print overload, its something I’m testing. If i print it this way I remove all spaces and newlines when I render to the page. Small SEO boost. Just playing for now as some functions where causing issues with other code.
Where do you get the idea that is an SEO boost? All you get is a very unreadable source. I would highly recommend you you use PDO. Here is a tutorial to get you going.
I see what you’ve done there, nice reminder. I’ve recently been doing something similar refactoring a bit of javascript, same principles apply.
Its working great now.
And thanks for the link @benanamen - I’ve been meaning to look into this
Where do you get the idea that is an SEO boost?
Its well known in the SEO circles. If you have thousands of lines of html code which can be compressed on rendering then its a win win as far as the browsers are concerned.
First you said it is an SEO boost, now you said it is a win win for the browsers.
While it may be “well known in the SEO circles” can you cite any source that shows it matters to google or any other search engine? If this is true I want to factually know about it so I don’t have to say @computerbarry said so.
I’m guessing you are referring to code “minification”, for the purpose of a speed boost.
It’s not something I have used, my take being that the gains are negligible weighed against the hoops you will jump through.
Though in the case where you do save a significant quantity of bytes by it, you must have a serious bloat problem for that to be the case.
I’m not one for believing SEO snake oil, in fact I usually write code so it will add newlines and tabs to the generated HTML so it’s easier to read in view-source.
I’m guessing you are referring to code minification, for the purpose of a speed boost.
Correct @SamA74 , this was the main purpose really.
you must have a serious bloat problem for that to be the case.
I’m just testing to see how things go.
Like with any javascript or css file its best practice to minify them for production, the same principle applies for HTML.
I usually write code so it will add newlines and tabs to the generated HTML so it’s easier to read in view-source.
Yes I agree @Mittineague, though this has no effect when you inspect the code everything is still formatted for easy viewing. Again, just testing.
can you cite any source that shows it matters to google or any other search engine
Not of the top of my head @benanamen its information and knowledge I’ve gathered over the years, been in many discussions and read many articles about minifying code and speeding up the page for the first paint.
Anyhow, cheers all getting a little side tracked now
I would say ok on the JS and CSS as I almost never need to look at it, but the HTML source, all the time.
Sure it does. It is one single line of code. What browser are you using that will show it formatted? EDIT: OK, I kinda take it back. If you use the Developers tools it will be formatted. View Source will not be. I want the option to see what the developer actually did without it being manipulated by dev tools.
For completeness, if you really feel the need to compress your HTML just enable GZIP compression on the server instead of messing with source code gymnastics. But as mentioned, if you need it you probably have a design problem.
As it’s marked as “Solved” I guess it’s OK to go off an a tangent, insn’t it?
I believe it is documented that speed has become a ranking factor, but how big a factor is another question, and how big the gains in speed from minification yet another.
Again, to make a significant difference, you need a lot of bloat to start with, so you are already on a loser if that’s the case.
Sure it does. It is one single line of code. What browser are you using that will show it formatted?
Right click and inspect - not view source.
For completeness, if you really feel the need to compress your HTML just enable GZIP compression on the server instead of messing with source code gymnastics
Extra benefit if you do both.
I guess it’s OK to go off an a tangent, insn’t it?
feel free! Ha
I believe it is documented that speed has become a ranking factor, but how big a factor is another question, and how big the gains in speed from minification yet another.
Aw c’mon @computerbarry, if your going to make a claim post the supporting link. Are you really going to make me go look for it, lol? I have not been in the SEO game for many years so I am not up on it. My gig is backend and you best not be trying to SEO my backend.
It depends of course, but I can’t imagine the speed difference between readable vs compressed HTML being more than an insignificant 0.0045ms or thereabouts. In my limited experience where the truly significant speed optimizations can be made are with unoptimized images.