Back to HTML

Friday, 7th December 2018

Welcome to the "new site". Well, actually everything looks exactly the same, but there’s changes to the code.

The previous version, as per my previous blog entry, used JavaScript to enable me to seperate the layout HTML from the individual page’s HTML. This meant making site updates a lot faster, because if I wanted to change the layout, I only had to do it once.

Unfortunately it came with the catch that Google and other search engines stopped indexing my site. This seemed confusing at first, as I’d read several articles stating Google at least does index JavaScript generated content (“dynamic content”). After a few weeks of my site not appearing properly in search results I did some research and discovered it’s due to my use of modern JavaScript OOP (JavaScript ES6 classes). Basically…

class SomeClass
  /* Google wont index anything generated here */

So, I’ve gone back to a traditional HTML site. Or at least the final thing is xD. I’m now using a PHP script to edit the site’s pages, layout and navigation, then I hit a button and it goes through generating all the final HTML pages. Then I upload that!

I could have just dropped the ES6 classes and re-done everything in functions, but I decided after all that I do want other search engines to index my site too, and many of them don’t parse JavaScript at all.

Oh and I'm not suddenly "Mr Anti JavaScript", but it's just good to bear this stuff in mind if you want your content to be indexed by search engines.

So, yeah, welcome to the “new site”!