I have a page of photo thumbnails on my site. On the page, a large number of links are grouped together consecutively, and the links take up at least 1/2 the HTML code size.
Here's an example:
<div>
<a href="1">1</a>
<a href="2">2</a>
<a href="3">3</a>
<a href="4">4</a>
....
<a href="50">50</a>
</div>
What I'm thinking to significantly reduce code size from about 20 bytes per link (which equals 10KB for pages with 500 links) to maybe a few dozen bytes total is to generate the links via javascript like this:
<div ID=\"links\"></div>
<script>
var div=document.getElementById("links");
for (n=1;n<=50;n++){
var anchor=document.createElement("A");
anchor.href=n;
anchor.innerHTML=n;
div.appendChild(anchor);
}
</script>
I did read at https://support.google.com/webmasters/answer/2721306 that automatically generated content is a bad idea but at the same time I'm trying to make users download fewer bytes.
My question is would search engines understand that I'm trying to produce actual static links with this code? and would all search engines consider this code legal, or would any search engine flag me? And we need to look at the buggy aspects of google because I don't want a robot to flag my account for generating static links via javascript.
The only reasons I'm looking into this is because I could cut my code size by at least 1/2 and also because I'm providing a static (non javascript-based link) on the same page that will allow guests to see content the javascript generated anchor tags link to.