I comment out lots of code to preserve it in case I need it later. Is this a bad practice for SEO? I’m not sure if Google reads commented code at all or not.
It’s a good question. Google and other SE’s totally ignore whatever is between <!-- … –> …
These are only meant for better viewing and understanding of the code by a user.
BTW, if they were considered in rankings, then people would start seeding KWs in the comment tag itself.
I comment out lots of code to preserve it in case I need it later. Is this a bad practice for SEO? I’m not sure if Google reads commented code at all or not.
So far as I know, commented code isn’t seen (I take this from how Google renders… or doesn’t… things for IE inside conditional comments that look on the outside like HTML comments), however if you happen to have a LOT of commented code, I’d go ahead and keep that copy on my own machine (or ona local machine and somewhere else on the server with the word “complete” added to the name) and upload to the web the version without the comments.
- this removes bloat from your code… if it’s a LOT of code you had, there may even be a small performance improvement (it would have to be a lot tho)
- if on some off-chance some non-google search bot bothers to read comments, it won’t matter
- you still have your commented code somewhere, so you didn’t lose anything.
BTW, if they were considered in rankings, then people would start seeding KWs in the comment tag itself.
Good point. People would have noticed if the content inside commented code mattered, and spammed it all long ago. : )
Well, that is a good question but I’d assume it wouldn’t bother as such. The only main downside I could think of - assuming it doesn’t - is if you have huge <!-- HTML comment –> sections it would bloat the page filesize and loading times, etc.
I’m pretty guilty of commenting out a lot of my code whenever I build a page, but I haven’t noticed anything that would suggest that it’s a bad thing to do.
My heavily commented pages perform just as well as my non-commented pages. Hardly scientific proof, but that’s my experience.